Home › forums › Chart Support › Excluding Date on X Axis when no data
Hi,
I am loading a data set that uses date for its x axis. I am seeing a few gaps in the chart, upon inspection it seems that there is an X axis entry being generated for a Date that is not in my data. Is there a way to turn this off?
gtsafas,
Can you please share a screenshot / jsfiddle so that we can understand the issue better?
— Sunil Urs
Hi Sunil,
I am not allowed to share screenshots and jsfiddle is blocked here. Let me try to explain better.
Assuming the following is true, 1) I have a stacked column graph 2) My x-axis is a date 3) I have data for Jan 1st, Jan 3rd, Jan 4th
When my graph is rendered it is showing me along the x-axis labels
Jan 1st, Jan 2nd, Jan 3rd, Jan 4th
I do not have any data for Jan 2nd and I dont see it being passed anywhere on my side. Additionally, if I mouse over the gap that Jan 2nd creates I dont get a tooltip, so that leans me even more towards the fact that I am not causing this.
If you guys have an email we can correspond over it, I can share SS there.
Thanks for any help
I modified one of your demos below. See how there is only 3/1 and 3/5. I only want to see 3/1 and 3/5 on the x axis. I cant seem to find a setting to do that.
<!DOCTYPE HTML> <html> <head> <script type="text/javascript"> window.onload = function () { var chart = new CanvasJS.Chart("chartContainer", { title:{ text: "Date time axis with interval 3 months" }, axisX:{ interval: 0, intervalType: "day" }, data: [ { type: "line", dataPoints: [//array { x: new Date(2012, 03, 1), y: 26, }, { x: new Date(2012, 03, 5), y: 38 } ] } ] }); chart.render(); } </script> <script type="text/javascript" src="/assets/script/canvasjs.min.js"></script> </head> <body> <div id="chartContainer" style="height: 300px; width: 100%;"> </div> </body> </html>
You can use interval and intervalType to achieve this.
Hi, can you explain what to set interval or intervalType to achieve this? I’m also trying to have the chart not display days that have blank data.
@limitedgoods,
Can you please create a jsfiddle reproducing the issue that you are facing. Also kindly elaborate what do you mean by what to set interval or intervalType to achieve this.
Also, you can use scaleBreaks to remove days that have blank data.
___________ Indranil Deo, Team CanvasJS
You must be logged in to reply to this topic.