Automatically set tickInterval depending on labels width - highcharts

Is it possible to set tickInterval automatically depending on axis labels width in highcharts?
In the first case tick interval is fine, but in the second it is too small. How can I set optimal interval for different sets of values?

You can only use tickPositioner, which allows to define dynamic ticks http://api.highcharts.com/highstock#xAxis.tickPositioner

Related

QChart set tick with uneven space

In QChart, how can I set tick with uneven space? In the example chart below, notice the first grid is smaller than others. How is it actually done? Thanks.
You need to set the TickType of your QValueAxis to QValueAxis::TicksDynamic.
Then you can set a tick anchor (i.e. the value where the first tick should be placed, e.g. 80.0 in the example image you provided) and tick intervals (the value between ticks, e.g. 2.5 in the example image)
Please note that dynamic ticks were only introducted in Qt 5.12.

Highcharts - Highstock: fixed width intervals with scrollbar

I need the points of my chart to have a fixed width (say, 100px each). If the needed space exceed the width of the chart, I just want to be able to scroll horizontally (with the scrollbar.enabled parameter set to true).
This is the basic setup, without setting the points width:
http://jsfiddle.net/wxxdne19/
If I set the column width like this:
http://jsfiddle.net/wxxdne19/1/
The tickPixelInterval parameter is ignored (as the documentation says, of course).
I tried a bunch of other things, but none of them worked, and I ran out of ideas. How can I do what I need?
Update
To clarify what I need, think of it as if I have a column chart, and I need to force all the columns to have a fixed width. Something like this:
http://jsfiddle.net/4rx4snjh/
But, instead of the columns overlapping each other, I'd like the scrollbar to do its job :-) Furthermore, I need it to work with any kind of series (lines, areas...), not just columns.
It seems that the solution here is to compute extremes manually and set them in load event:
load: function() {
var chart = this,
xAxis = this.xAxis[0],
visibleColumns = (xAxis.width - pointWidth) / pointWidth;
xAxis.setExtremes(pointStart, pointStart + pointInterval * visibleColumns);
}
Live demo: http://jsfiddle.net/kkulig/mpancrbc/
For some reason (bug probably) xAxis.min value must be initialized when the container width is a small value (in my example it's less that 400 px or so).
API reference: https://api.highcharts.com/class-reference/Highcharts.Axis#setExtremes

Set minRange in Highcharts at week, but doesn't work

i have a problem with minRange
My chart is "time series, zoomable" type (i enabled also scrollbar for x-axis).
I would like to have minRange weekly when i zoom the chart, but doesn't work...
`http://jsfiddle.net/rax26mvb/`
why ?
thanks!
The minRange define maximum zoom level, when you zoom by selection. In your case you need to also define min/max values on xAxis.

How to Change space between series data colums in highcharts?

This is not DUPLICATED!!! Sorry if yes.
I want to increase the space between columns independently to the pointWidth property and the #container width. Please this couple of pictures
and the fiddle is here
How can I edit this space/margin/padding ?
In your current chart, the number of bars you have, combined with the fixed pointWidth of 14 (pixels) you have set on each series, means that the groupPadding setting which you have not set and therefore defaults to 0.2 (x-axis units) is squashing the bar pairs together, overriding any increase you try to set to pointPadding.
If you reduce groupPadding, like so, the pairs will come apart accordingly. If your number or bars and/or chart width are variable, and you want to fix the ratio of the gaps between points and groups, then set your pointPadding and groupPadding as required, and remove the fixed pointWidths you have specified so that the bar widths take up the slack, like this.
You can use pointRange / groupPadding / pointPadding, skipping pointWidth.
http://api.highcharts.com/highcharts

How to set min and max values for an axis?

I have some data that can have values in the range (0..100). Highcharts will sometimes label the axis from -10 to 110, which looks odd.
How can I prevent this? I can set a fixed min and max value for the axis, but if the current values happen to be between e.g. (50..60), I'd rather let Highcharts zoom in on the axis accordingly. Just don't want Highcharts to ever show anything outside of (0..100).
I could of course determine the appropriate min and max values myself every time I load data, but was hoping there would be some kind of minMin and maxMax setting?
So it looks like this isn't possible; opened a feature request.
Nowadays highcharts has floor and ceiling options for this use case.

Resources