High charts not displaying date correctly in x axis per epoch? - highcharts

Two Part Q:
Why is high charts not correctly aligning and displaying the following date on the x axis?
How can I align the date on the x axis with the points in each series?
I have tried adjusting to tickinterval to various values but to no avail on either issue.
tickPixelInterval: 200
Fiddle->http://jsfiddle.net/EwpWh/

Use datetime axis instead of linear, see: http://jsfiddle.net/Fusher/EwpWh/5/
xAxis: {
type: 'datetime',
labels: {
formatter: function () {
return Highcharts.dateFormat('%m/%d', this.value);
}
},
tickPixelInterval: 200
},
However if you want to have ticks exactly in the same place as points are, you need to use one of:
tickPositions: http://api.highcharts.com/highstock#xAxis.tickPositions
tickPositioner: http://api.highcharts.com/highstock#xAxis.tickPositioner

Related

Highcharts: align markers with xAxis

I have a type area chart, with minor grid lines and a datetime xAxis. data is feed through an array of y values, and I got to render xAxis labels depending on the data length successfully.
My issues are:
the chart has a unwanted padding on the X axis
the markers don't align with their labels
Check it:
Here's a working fiddle: https://jsfiddle.net/fernandaparisi/e07q32ay/53/
I noticed that if I remove all the max, min, tickInterval, pointStart and pointInterval properties the markers are aligned correctly, but the chart doesn't expand its full available width.
margin and spacing chart properties seem to affect the chart as a whole, and not the plotted area.
Any thoughts?
The padding is caused by combined tickInterval and endOnTick: true, to remove it just disable endOnTick.
To position the labels in a different way use align, x and y properties.
xAxis: {
labels: {
align: 'center',
y: 30,
formatter: function() {
return Highcharts.dateFormat('%e %b', this.value);
},
rotation: -45
},
title: undefined,
type: 'datetime',
min: lastSunday - (weekLength * (data.length - 1)),
max: lastSunday,
tickInterval: weekLength,
endOnTick: false,
minorTickInterval: weekLength
}
Live demo: https://jsfiddle.net/BlackLabel/eLbp48d3/
API Reference:
https://api.highcharts.com/highstock/xAxis.labels.align
https://api.highcharts.com/highstock/xAxis.endOnTick

Highchart Min Max for y-axis per series

i have a highchart with 4 series. I also only set the min value for each y-axis to 0 cause there arent any negative values possible. now highchart is calculating the max value by itself what is nice BUT i need this for each series itself. The reason is that i have 2 series with very high values from the range up to 5000 and the other two values are relativ small from 0 to 50.
The max value highcharts calculates is used for all four series - so the chart looks like this:
As you can see you can only see the two high value series - the other two arent really visible at the bottom of the chart.
When i disable the two series with the high values the chart looks nice for the other two values:
is there any flag i can use so highchart will calculate the max value / scale per series? Or have i really calculate it by myself - also on zoom and so on.
I found this: https://github.com/highcharts/highcharts/issues/4248
But i thought thats some basic functionality with is needed very often so there has to be something..
greetings
Maybe it would be better to use logarithmic axis type? Your chart would have only one axis adjusted to much difference between the values of series points. When it comes to differences between units of measurement, always you can set the different tooltip.pointFormat definition for specific series.
Highcharts.chart('container', {
title: {
text: 'Logarithmic axis demo'
},
yAxis: {
type: 'logarithmic',
},
series: [{
data: [1, 20, 30, 22, 16, 32, 45, 24, 11, 2],
pointStart: 1,
tooltip: {
pointFormat: '<b>{point.y} km/h</b>'
}
}, {
data: [4500, 3450, 4242, 2348, 5216, 3212, 4564, 3128, 5256, 4512],
pointStart: 1,
tooltip: {
pointFormat: '<b>{point.y} kW/h</b>'
}
}]
});
Live example: https://jsfiddle.net/bfnj4mp8/
API Reference:
https://api.highcharts.com/highcharts/yAxis.type
https://api.highcharts.com/highcharts/series.line.tooltip.pointFormat

Highcharts x axis dates displayed slanting

Im using Highcharts to generate a line chart. On my x-axis, I use dates and its all displaying but for some reason its displaying slanting.
How can I fix it? Here is my x-axis properties.
xAxis: {
categories: report_2_weekly_categories,
tickInterval: 180,
labels:{
format : '{value} CST'
}
},

HighCharts xAxis categories over 1000 data not work.

I want to draw basic line chart.
When the data type of x-axis is numerical,
I can use the following options to draw this chart when the number of x labels is larger than 1000
plotOptions: {
line: {
turboThreshold: 2000,
},
series: {
turboThreshold: 2000,
}
}
But it seems not work when the data type is categorical and the number of category in x-axis is too large (> 1000 categories)
The link I had tried:
Test on jsfiddle
Is there any solution about this problem?
Many thanks
Check this fiddle: http://jsfiddle.net/am2k9c1t/
Code:
xAxis: {
tickInterval:10,
min:1200,
}
Set tickInterval value in xAxis.
example:
xAxis: {
tickInterval:100
}
Test it here

Increase or decrease point intervals in high chart

I would like to have specific point intervals in high chart.
I have a passrate chart where in the Y axis shows the percentage passrate. But I would like be able to alter the y axis plot points.
Please refer to this fiddle.
http://jsfiddle.net/Mn6sB/2/
Here is a small code piece - how ever the range is not 10 intervals.
yAxis: {
title: {
text: 'PassCount'
},
min: 0,
max:100,
minTickInterval:10
},
minTickInterval: NumberSince 2.3.0
The minimum tick interval allowed in axis values. For example on zooming in on an axis with daily data, this can be used to prevent the axis from showing hours.
If you want the y axis tick interval changes when you zoom in, you need to enable the zooming first.
chart: {
renderTo: 'chartContainer',
type: 'spline',
zoomType: 'y'
}
Or, if you want to fix the tick interval, what you need is not minTickInterval but tickInterval
So your small code piece should be:
yAxis: {
min: 0,
max:100,
tickInterval:10
}

Resources