а

Plot a date in x-axis in dhtmlxChart


#1

Hi

while trying to plot the date in x-axis

I tried implementing the below method:
xAxis:{
template:function(obj){
return dhtmlx.Date.date_to_str("%d/%m/%Y")(obj.$unit);
},
lineColor:function(obj){
return obj.$unit.valueOf() == (new Date(2016,1,1)).valueOf()?"#737373":"#cfcfcf"
},
value:function(obj){
return dhtmlx.Date.str_to_date("%d/%m/%Y")(obj.date);
},
units:{
start:new Date(2016,7,1),
end:new Date(2016,7,20),
next:function(d){
return dhtmlx.Date.add(d, 1, “day”);
}
}
},

Uncaught TypeError: date.split is not a function is the error displayed. I am not able to understand the reason for this error

and when I gave the end date lesser than start date, I am able to view the graph but no values on x-axis and the values are not being plotted.
Kindly help me display the values in x-axis and display the line’s in x-axis.


#2

Could someone please reply


#3

Apparently DhtmlxChart acceps inpput only as “02/07/2016” the quotes are important.


#4

Unfortunately the problem cannot be reproduced locally.
Your code works well for me.

If the problem still occurs for you please, share with a demo link or provide with a complete demo, where the problem can be reconstructed.


#5

I was able to fix it when I converted date to String I didn’t add Quotes, once the date input was displayed in quotes, it worked.