score:14
Only way I could get it to show it "correctly" was by also providing an yAxis max
value. I think this is a HighCharts issue when you provide no data elements with a y-value. It draws the best chart it thinks it can.
score:0
Just add "min" option
yAxis: {
min: 0
}
score:0
For Highcharts 5.x.x, you should be able to just specify:
yAxis: {
softMin: 0,
softMax: 1,
};
This won't work for line chart, which requires that you also set minRange
in the same config object as above. Experiment with different values, since defining for example minRange: 6
, created a range on yAxis between 0 and 4.
score:0
score:3
Here is a fix I came up with that doesn't require any preprocessing of the data and just let highcharts do it, like it used to before the update. http://jsfiddle.net/QEK3x/
if(chart.yAxis[0].dataMax === 0)
{
chart.yAxis[0].setExtremes(0, 5);
}
You only need to check the first series axis, as if the first one is not 0 then the problem won't occur. I might submit a pull request for this to high-charts, though I kinda feel like they intended for this functionality for some reason.
score:3
Since Highcharts 5.0.1, you can also use softMax.
softMax: Number
A soft maximum for the axis. If the series data maximum is greater than this, the axis will stay at this maximum, but if the series data maximum is higher, the axis will flex to show all data.
yAxis: {
min: 0,
softMax: 100,
...
}
Here is an example with a column chart : http://jsfiddle.net/84LLsepj/
Note that currently, in Highcharts 5.0.7, it doesn't seem to be working for all types of charts. As you can see in this other jsfiddle, it doesn't work with line chart.
score:5
I had also posted this to the HighCharts forum, where I got a response that seems to work. Unfortunately, it will involve me doing some pre-processing of the data prior to rendering the charts in order to check for all "0" data values... but it'll work. Just wish there was something more "built-in" to HighCharts.
So after summing up the "y" values, if I get 0, the y-axis properties should look like this:
yAxis: {
minPadding: 0,
maxPadding: 0,
min: 0,
max:1,
showLastLabel:false,
tickInterval:1,
title: {
text: ""
}
}
See: http://jsfiddle.net/KM2Jx/2/
The keys seem to be the "max" and "showLastLabel" properties.
score:42
I've found another (and very simple) solution:
You can set y-axis minRange
property:
yAxis: {
...
minRange : 0.1
}
This makes Highcharts render yAxis min and max values when all data is 0.
UPDATE:
Highcharts 4.1.9 fix also needs:
plotOptions: {
line: {
softThreshold: false
}
}
Source: stackoverflow.com
Related Query
- Highcharts: Ensure y-Axis 0 value is at chart bottom
- Highcharts: min value of y axis on the bottom of chart
- HighCharts - Show categories in x axis intead of the value of x in Bubble Chart
- min and max axis value not respected in HighCharts chart with a logarithmic axis
- Displaying max value in bottom of the pie chart - highcharts
- How to set Highcharts chart maximum yAxis value
- How to display the value instead of percentage in a pie chart using jquery Highcharts
- How replicate the value of Y Axis on both sides of the axis in Highcharts
- Highcharts - How to start x axis from an arbitrary value
- Highcharts - best way to handle and display zero (or negative) values in a line chart series with logarithmic Y axis
- How to add space between chart and axis in highcharts
- HighCharts Pie Chart Legend value alignment
- Show value of last point as label or tooltip on Highcharts Stock Chart
- Highcharts blank chart with x and y axis
- Dual axis using percentage and absolute value to same serie in Highcharts
- Getting the X Axis value in HighCharts
- Highcharts reversed line chart is partially hidden at min value
- Highcharts - Bar - Setting the X axis width and the chart area width to be constant
- Highcharts show plot value on x axis label
- Highcharts - stop Y axis value change on redraw
- Adding round corners to Highcharts Bar Chart with stacked bars when value is 0
- HighCharts Stock Chart error code 18
- HighCharts - Need more space between bottom of chart and Xaxis labels
- How to change space value between grid and yAxis in Highcharts line chart
- Negative value for categories axis in highcharts
- Resizing HighCharts Chart Causes Changes to Max Y Value
- Highcharts - creating chart with same scale axis
- Highcharts - Cross browser charts have different Y axis ranges, how can I ensure consistency?
- Calculating a min y axis value in highcharts
- Highcharts column chart color by single color but with different brightness level as per respective column value
More Query from same tag
- Highcharts javascript error when other javascript file is included
- highcharts non numeric range on secondary yAxis
- how remove picture frame for Highchart chart pie
- Plot one point on Highcharts JS graph according to x-axis?
- can we set the data labels out of the slice if it is not fit in +highchart?
- Highcharts crosshair label is behind legend
- Drilldown on label in spiderweb graph
- How to change HighChart xAxis timeline to match local time and not UTC?
- Highcharts bar chart with fixed bar widths and gaps
- Responsiveness of the annotations in highcharts
- Backgroud Bell Curve and show tooltips in Highchart charts
- Where can I find the type definition of the Highcharts.AnnotationsOptions type?
- document ready call sql function
- Few Partial Views(charts) on one page
- Using HighCharts setData for multiple variables?
- How do I prevent Highcharts from truncating categories?
- Generate highchart instance on floating div from mouseOver on axis label or from series point
- Highcharts ( stockchart series line is not connecting to the last point
- Highcharts display scrollbar when zooming
- Highcharts - Custom toggle button using the exporting buttons
- Error :'error TS2339: Property 'data' does not exist on type 'Response'.- Angular
- Highchart stacked area empty spaces (negative values)
- Highcharts bar chart with bar colored based on value
- Highchart error make the whole page breakdown
- Multi-categories selection Chart in Highcharts
- highchartjs create label for column
- Is it possible to reparent the high charts legend?
- How to auto adjust Y axis plot lines in live high chart
- Set enable/disable 3D mode with Highcharts
- Highcharts Dynamic Chart (Updating over certain interval) PHP+MySql Example