mardi 4 mars 2014

Adding timeAxis with Dimple.js


Vote count:

0




I have the following dimple.js code:



var svg = dimple.newSvg("#chart_montreal", 590, 400);
d3.csv("data/data_montreal.csv", function (data) {
data = dimple.filterData(data, "parameter", ["DCE_1_2","DCE_1_3","DCE_1_4"])
var myChart = new dimple.chart(svg, data);
myChart.setBounds(60, 30, 505, 305);
var x = myChart.addTimeAxis("x", "date","%m-%d-%Y-%H%M%S","%m-%d-%y-%H%M%S");// 09-11-2007 15:15 "%m/%d/%y_%X","%m/%d/%y %X"
console.log(x);
//x.addOrderRule("date");
myChart.addMeasureAxis("y", "values");
myChart.addSeries("parameter", dimple.plot.area);
myChart.addLegend(60, 10, 500, 20, "right");
//myChart.setMargins("0%","0%","0%","30%");
myChart.draw();
});


The console.log(x) returns an object; in the inspector in Chrome, I can read the values of x as:



_max: Mon Sep 24 2007 12:00:00 GMT-0500 (Central Daylight Time) proto: Invalid Date


_min: Tue Sep 11 2007 15:15:00 GMT-0500 (Central Daylight Time) proto: Invalid Date



Sample of csv:



parameter,date,values,sample,


benzene,09-11-2007-151500,150,PO1-1-110907,


chlorobenzene,09-11-2007-151500,1900,PO1-1-110907,


DCE_1_2,09-11-2007-151500,5500,PO1-1-110907,


DCE_1_3,09-11-2007-151500,1000,PO1-1-110907,


DCE_1_4,09-11-2007-151500,3000,PO1-1-110907,


ethylbenzene,09-11-2007-151500,100,PO1-1-110907,



Consequently, the date shows up correctly, the the time is completely erased.


I assume it's a bug, as there's no errors being reported.


The working file is here: http://ift.tt/1kXtIPx


Does anyone see if there's something wrong with the formatting or know a trick in d3 to fix this?



asked 55 secs ago






Aucun commentaire:

Enregistrer un commentaire