Hi, I have been trying to change the label steps of my category axis but I cannot find a way in the API to do this except for setting the steps to a fixed number .Labels(label => label.Step(12)).
5 Answers, 1 is accepted
One way to do that on the server side is to manually calculate the value of the "step" property in the C# code and set this value in the MVC wrapper.
On the other hand, this can be done on the client-side using the "setOptions" method:
by passing the calculated value as a "categoryAxis.labels.step" option after the chart has been initialized:
If you want to change a specific option setting and keep the rest untouched, you can get the options beforehand and update the "step" value only:
takes the current configuration of the category axis and updates the step from 3 to 1.
Can you have a look at the sample and inform me if this is what you want to achieve?
That works great, thanks!
Can I also access the HtmlAttributes through setOptions to change the height of the chart or does that work differently?
HtmlAttributes values are passed as attributes to the rendered "div" element (that is the wrapper) and the chart automatically resizes to its dimensions, so setting:
The chart does not have width/height options, which can be checked in the documentation:
This is the reason why using "setOptions" will not change the dimensions. What I can suggest is to set the dimensions on the "div" element directly, e.g.: