I have a Highcharts area chart, with string categories on the X-Axis. I want the chart to start at the left most edge of the x-axis and end at the rightmost edge, without any padding. In the image below, the red arrows show the spacing that I want to get rid of. Without text categories this is easily achievable, but with I just can't seem to figure it out. Any help appreciated, thanks.
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- void before promise syntax
- Keeping track of variable instances
- Can php detect if javascript is on or not?
Just add:
You can achieve the desired result by redefining labels.formatter on axis. jsFiddle is here.
But if you want to keep it simple and pass
axis.categories
in traditional way (I think that this is a way more better), I suggest you to use a tiny hack and redefine anAxis.init
function. Try it on jsFiddle.UPD: I've updated my previous fiddle a little. Check it out. I think that you can combine all my solution to get a nicer one.
A cleaner solution is to use the
pointPlacement
reference provided in the Highchart API.Add
pointPlacement: 'on'
and you should be in business. (For reference, here is their example JSFiddle)You can use spacingLeft and spacingRight to set the spacing:
You need the following settings.