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
- Highmaps drill down map select event
- Maximum number of datapoints allowed in a highcharts/stock series data hash
- Highcharts: X-axis labels inside columns
- I'm trying to have a hide series button on my highchart but it makes the chart disappear
- Highcharts issue when dealing with 3D pie and large labels
- Highcharts: Syncing axis ticks across Multiple Charts
- Vertical align legends in highcharts with two column
- Disable color-cycling in Highcharts
- export csv from highcharts
- Highcharts (highstocks) tooltip does not work on latest firefox 64.0 with useHTML=true
- Flowchart drawing with drilldown possible?
- How to re-render a graph at a given interval that retrieves data from a controller in Rails?
- Official Typescript support for Highcharts
- Highcharts - Exporting with credits in IE 7/8
- Highcharts tooltip on IE9
- HighCharts Export Breaks After Resetting Chart Options
- Higchahrts click entire column to trigger point click event
- Plotting data and time zones on highcharts react
- Highcharts img in html title; onerror doesn't fire even with Highcharts Security AST set
- Need to put border on variablepie highchart?
- Server side chart .svg export with Highcharts and PhantomJS, error loading data from .csv file
- Populating Highcharts chart with data received from MySQL
- Highcharts Stacked Column chart change legendItemClick function
- How to know information about the clicked bar in highchart column r shiny plot
- Highcharts: Is it possible to have a single series exist in multiple stacks in a grouping
- Hidden Highcharts not sizing correctly until window resize
- Add Interactive Map with Highcharts Maps
- Highcharts :: Codeigniter
- Legend order for proximate layout
- How to set column width for columnRange chart with multiple series