score:1
The issue is the use of this.x
here:
for (i = 0; i < 4; i++) {
sum += series[i].yData[this.x];
}
For "normal" x-axis types this works well since you can open the yData
by index. In your case it will end up trying to find something like series[0].yData[1262304000000]
, which won't work.
I'm not aware of any easy way to find the relationship between the timestamp this.x
and which index that has on the x-axis. My solution uses another for loop to compare the timestamp from this.x
with the xData
array, and if it matches we use the data in the sum, as shown in this updated formatter
:
formatter: function () {
// If doing negative, ignore
if(this.total <= 0)
return;
var sum = 0;
var series = this.axis.series;
for (var i = 0; i < series.length; i++){
for(var j = 0; j < series[i].xData.length; j++) {
if(series[i].options.type == 'column' && series[i].xData[j] == this.x) {
sum += series[i].yData[j];
break;
}
}
}
return sum;
}
This updated JSFiddle shows it in action.
score:1
If I understand what you're asking for correctly, the following formatter function should work:
formatter: function () {
return this.total >= 0 ?this.total : null ;
},
As to the available options in the formatter function, http://api.highcharts.com/highcharts#plotOptions.column.dataLabels.formatter should help. But, I tend to just put a breakpoint in the function and inspect what this
is. :)
Source: stackoverflow.com
Related Query
- How to get proper stack labels with 'datetime' axis?
- Highcharts - with datetime axis labels overlap
- How can I force ticks/grid lines on a Highcharts datetime X axis to arbitrarily line up with data points?
- How To Show All Data Labels For Datetime Axis In Highcharts
- How to get the axis value with respect to the cross hair in highcharts
- HighCharts - Angular, how to get y axis labels on the vertical lines drawn from x axis
- How to get points information when hovering over axis labels in highcharts using custom-events library?
- How to fix formatting of axis labels in Highcharts when surrounding the contents with div?
- How can I get the max value of a y axis at highcharts?
- How to prevent highcharts from shortening labels with ellipsis
- How to get rangeSelector to work with HighCharts
- How to show all values at datetime axis in highcharts?
- How to display highchart y axis with constistant data
- Highcharts - How to get a value of a stack in a series?
- Highcharts label format with tickPositioner in a datetime x Axis
- last label in x axis with datetime format not coming in highchart
- In highcharts, is it possible get the exact position of x axis labels for overlap detection purpose?
- Highcharts How to get decimal point values on y-axis with big numbers
- How to show only specific x-axis values on datetime axis in Highcharts
- How to place labels on opposite Y axis in Highchart without a second series
- High chart - Column Range Chart with Time range. How to get tooltip as Start and End time
- How to populate a Highcharts axis with string formatted data from a PHP array
- How to adjust line-height/ellipses in Highcharts axis labels
- HighCharts scatter plot with Datetime on X Axis not plotting values correctly
- How to place x axis labels on top of horizontal bar chart
- how to get the axis value when I click on a cursor in highstock(high charts)?
- How to position labels for plotbands on y axis in Highcharts
- How can i get the json data with the specific between Year?
- Replace axis labels with custom in highcharts r
- How to get rid of the line labels in highcharts?
More Query from same tag
- highcharts line graph with ajax
- Highcharts in Angular - accessing the API
- Highmaps downloadXLS() issue with MacOS Safari
- UIWebview not scrolling in jquery part
- How to move point's label and SVGs by moving a point graphic in highcharts gantt?
- Highcharts- Unable to change yAxis label
- How to create a javascript column chart with overlapping columns of variable width
- r shiny with highcharts: filter second plot based on hover from the first plot
- HighChart not showing anything
- "display: none" with highcharts - incorrect size
- How to Change Legend Text of a Chart Object in Crystal Reports 10
- Highchart drawing issue
- Changing month names of a highchart plot
- Is it possible to use R Plotly library in R Script Visual of Power BI?
- How to hide stackLabel in highcharts when it is bigger than the column
- Highchart js bar graph label left alignment
- Highcharts plot band to last datetime value from spreadsheet data
- How do you add text to the bottom center of legend and bottom center of chart under legend?
- HighCharts multiple axis not recognized
- Ignore tfoot table rows when creating Highcharts from HTML table
- minimum in Highcharts not working
- Showing only the first custom label. Highcharts
- Integrate keen.io json to highcharts js
- Highcarts with zoomType + default level
- rCharts shows limited functionality when used with Shiny 0.8.0.99
- How to update chart only on unique data in HighCharts
- How to run specific javascript files to update gui
- HighCharts: render the xAise line as the yAise line
- page.data.json 404 not found & componentDidMount() not firing in production
- High Charts PieChart How Can I show point value inside segment and label name outside