Amchart x-axis date format -



Amchart x-axis date format -

i have amchart 2 different categories, date mysql database in "yyyy-mm-dd hh:mm:ss" format. problemist date not displayed right on chart.

<script type="text/javascript"> var chart; var graph; var chartdata4 = [ {"year":"2014-11-05 21:16:37", "v1":7.3, "v2":99.9}, {"year":"2014-11-05 21:17:36", "v1":7.3, "v2":99.9}, {"year":"2014-11-05 21:18:07", "v1":7.3, "v2":99.9}, {"year":"2014-11-05 21:30:01", "v1":7.3, "v2":99.9}, {"year":"2014-11-05 21:45:02", "v1":7.2, "v2":99.9}, {"year":"2014-11-05 22:00:01", "v1":7.2, "v2":99.9}, {"year":"2014-11-05 22:15:01", "v1":7.1, "v2":99.9}, {"year":"2014-11-05 22:30:02", "v1":7.1, "v2":99.9}, {"year":"2014-11-05 22:45:02", "v1":7.1, "v2":99.9}, {"year":"2014-11-05 23:00:02", "v1":7.1, "v2":99.9}, ...... {"year":"2014-11-07 19:45:02", "v1":5.5, "v2":96.3}, {"year":"2014-11-07 20:00:02", "v1":5.5, "v2":96.3}, {"year":"2014-11-07 20:15:02", "v1":5.5, "v2":97.1}, {"year":"2014-11-07 20:30:02", "v1":5.5, "v2":96.9} ]; amcharts.ready(function () { // serial chart chart = new amcharts.amserialchart(); chart.pathtoimages = "http://allopensensors.com/amcharts/images/"; chart.dataprovider = chartdata4; chart.marginleft = 10; chart.categoryfield = "year"; chart.datadateformat = "yyyy-mm-dd jj:nn:ss"; chart.addlistener("dataupdated", zoomchart); // axes // category var categoryaxis = chart.categoryaxis; categoryaxis.parsedates = true; categoryaxis.minperiod = "ss"; categoryaxis.dashlength = 3; categoryaxis.minorgridenabled = true; categoryaxis.minorgridalpha = 0.1; // value var valueaxis = new amcharts.valueaxis(); valueaxis.id = "ax1"; valueaxis.axisalpha = 0; valueaxis.inside = true; valueaxis.dashlength = 3; valueaxis.position = "right"; valueaxis.title="temperature in grade celsius" ; chart.addvalueaxis(valueaxis); var valueaxis2 = new amcharts.valueaxis(); valueaxis2.id = "ax2"; valueaxis2.axisalpha = 0; valueaxis2.inside = true; valueaxis2.dashlength = 3; valueaxis2.basevalue = -20; valueaxis2.position = "left"; valueaxis2.title="humidity in %"; chart.addvalueaxis(valueaxis2); // graph graph = new amcharts.amgraph(); graph.label="temperature"; graph.valueaxis = "ax1"; graph.type = "smoothedline"; graph.linecolor = "#d16fff"; graph.negativelinecolor = "#637bb6"; graph.bullet = "square"; graph.bulletsize = 8; graph.bulletbordercolor = "#ffffff"; graph.bulletborderalpha = 1; graph.bulletborderthickness = 2; graph.linethickness = 2; graph.valuefield = "v1"; graph.title = "title v1"; graph.balloontext = "[[category]]<br><b><span style='font-size:14px;'>[[value]]</span></b>"; chart.addgraph(graph); graph2 = new amcharts.amgraph(); graph2.valueaxis = "ax2"; graph2.type = "smoothedline"; graph2.linecolor = "#d1655d"; graph2.negativelinecolor = "#637bb6"; graph2.bullet = "round"; graph2.bulletsize = 8; graph2.bulletbordercolor = "#ffffff"; graph2.bulletborderalpha = 1; graph2.bulletborderthickness = 2; graph2.linethickness = 2; graph2.valuefield = "v2"; graph2.title = "title v2"; graph2.balloontext = "[[category]]<br><b><span style='font-size:14px;'>[[value]] </span></b>"; graph2.label="tessst"; chart.addgraph(graph2); // cursor var chartcursor = new amcharts.chartcursor(); chartcursor.cursoralpha = 0; chartcursor.cursorposition = "mouse"; chartcursor.categoryballoondateformat = "jj:nn:ss"; chart.addchartcursor(chartcursor); // scrollbar var chartscrollbar = new amcharts.chartscrollbar(); chart.addchartscrollbar(chartscrollbar); chart.creditsposition = "bottom-right"; // write chart.write("chartdiv4"); }); </script>

see here: http://allopensensors.com/author/andreas , 3rd chart,

on other charts have line categoryaxis.parsedates = true; commented out, on 3rd chart isn't. provide axis match others.

as have time info charts improve in sentiment axis in chart 3. remove comment other charts match one.

amcharts

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -