I have a list of data with two columns Interval and Count. The interval column is currently a string representing a time in 5 minute increments (i.e. 00:05). I would like these to be unique bars in my standard bar chart but I want the X-Axis to only display hours (i.e. 1, 2, … 24). Trying to display all the X labels just appears as a black bar because of overlap. Any ideas?
maybe something that?
xAxis:{
template:function(obj){
var t = obj.time;
var minutes = parseInt(t.split(":")[1],10);
if(minutes==‘00’)
return obj.time;
else
return “”;
}
}
The conversion using parseInt for some reason did not like the number 08 and 09 since it kept thinking they were 0. As a result I ended up with the following solution. It does not print 00:00 since it was too close to the Y-Axis. I was unaware you could use a function within the template configuration. Thanks
template: function (obj) {
if(obj.interval.substring(3,5)=='00' && obj.interval.substring(0,2)!='00')
return obj.interval.substring(0, 2);
else
return "";
}
I’ve a similair problem as ddelella descripted. I tried the suggested code and I see that the time on the xAxis is shown as coded. However I believe I can’t return from the template:function.
Should the data list contain a specific character to return from the function or should I do somethng else?
I found the reason why. The list of data ended with a {}, like this:
[{“sample”:“00:00”, “IT”:10.0, “OT”:0.0},
…
{“sample”:“23:00”, “IT”:13.0, “OT”:-3.0},
{}]
Removing the last empty {} solved the issue.
Hi, ddelella
Hi, Materie62
Could you attach your chart data? We’ll try to help you on your examples.
And waht type of chart do you have?