javascript - Dimplejs Bug. Line does not show up when series is not null -


i have setup dimplejs.org line chart. should able the clicks colourized blue red (less clicks , line blue, more clicks , line uses gradient blue red).

if set series following works fine; tooltip includes x , y points (week , clicks). need tooltip include month.

var myseries = mychart.addseries(null, dimple.plot.line); 

if modify series (as per other examples on dimplejs.org , shown below) include fields in array, line disappears , gradient error in console.

var myseries = mychart.addseries(["month","week","clicks"],dimple.plot.line); 

i have tried tooltip; doesn't help:

myseries.gettooltiptext = function (e) {                 return [                     "month: " + e.aggfield[0],                     "week in year: " + e.aggfield[1],                     "clicks in week: " + e.aggfield[2]                 ];             }; 

i have created fiddle bug/issue. can show me how colourized lines show , without console error. hope can help.

here fiddle:

http://jsfiddle.net/eformx/bel2bwa3/

there seem issues gradient line, works in simple cases. don't think can realistically made work across different axis types remove feature future releases. logic depends on category vs measure axis. if can made suit case can achieve want.

the data in fiddle link doesn't seem quite match question achieve describe follows. due limitations of gradient line need use measure axis , category axis put data in using custom tooltip method:

var svg = dimple.newsvg("body", 800, 600);  var data = [     { "month" : "jan", "week" : "2014-01-20", "clicks" : "10"},     { "month" : "jan", "week" : "2014-01-27", "clicks" : "4"},     { "month" : "feb", "week" : "2014-02-03", "clicks" : "35"},     { "month" : "feb", "week" : "2014-02-10", "clicks" : "46"},     { "month" : "feb", "week" : "2014-02-17", "clicks" : "34"},     { "month" : "feb", "week" : "2014-02-24", "clicks" : "26"},     { "month" : "mar", "week" : "2014-03-03", "clicks" : "12"} ];  var chart = new dimple.chart(svg, data);  chart.addcategoryaxis("x", "week"); chart.addmeasureaxis("y", "clicks"); chart.addcoloraxis("clicks", ["blue", "red"]); var s = chart.addseries(null, dimple.plot.line);  s.gettooltiptext = function(e) {     var i,         row;     (i = 0; < data.length; += 1) {         row = data[i];         if (row.week === e.xfield[0]) {             return [                 "month: " + row.month,                 "week in year: " + row.week,                 "clicks in week: " + e.yvalue             ];         }     } };  s.lineweight = 5; s.linemarkers = true;  chart.draw(); 

http://jsfiddle.net/bel2bwa3/3/


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -