I have to create a bar graph which shows a graph for 30 days. So I will show total 30 bars on the chart. But it looks very congested on the x axis. Is there a way where I can show only 6 x-axis ticks and not all the 30 x axis ticks?
I know that this is an old question but I need some solution too so here it is:
When you use jqplot
to print bars you can't say it how many ticks it should print because it prints only related values so you have to print all ticks. My solution is not nice but it works. Just print ticks with empty label. For example:
axes: {
xaxis: {
min:1,
max: 30,
ticks: [[1,""],[2,""],[3,""],[4,""],[5,"5"],
[6,""],[7,""],[8,""],[9,""],[10,"10"],
[11,""],[12,""],[13,""],[14,""],[15,"15"],
[16,""],[17,""],[18,""],[19,""],[20,"20"],
[21,""],[22,""],[23,""],[24,""],[25,"25"],
[26,""],[27,""],[28,""],[29,""],[30,"30"]]
}
}
By using ticks
option of axies, you can specify exactly which ticks you want to show.
Link to the doc : http://www.jqplot.com/docs/files/jqplot-core-js.html#Axis.ticks
©2020 All rights reserved.