score:0
Accepted answer
There seemed to be no documentation or other examples on the net on how to do this. So I experimented and found out that the index is set naturally by the order in which you add to the series array. So I could change my seed series to this:
series: [
{
name: 'Total', // The series you add first will get stacked on the top
data: randomRange(12, 233, 240),
stack: 'ProductType'
}, {
name: 'My Products',
data: randomRange(12, 7, 61),
stack: 'ProductType'
}
]
Then when I refresh the chart data with different options, I do this:
$('#productType').on('change', function() {
var chart1 = $('#quantityPerMonthChart1').highcharts();
// These series already have an index (which affects stack order).
// Here it is unchanged.
chart1.series[0].setData(randomRange(12, 233, 240), false);
chart1.series[1].setData(randomRange(12, 7, 61), false);
chart1.redraw();
});
score:3
index
is option of a series that can be update using Series.update()
- it can be also used to update data of the series as data is another option.
$(function() {
var chart = Highcharts.chart('container', {
chart: {
type: 'column'
},
plotOptions: {
series: {
stacking: 'normal'
}
},
series: [{
data: [1, 2, 3, 4, 5, 4],
index: 1
}, {
data: [6, 4, 5, 6, 7, 4],
index: 2,
id: 's2'
}]
});
$('#button').click(function() {
chart.get('s2').update({index: 0});
});
});
Example: http://jsfiddle.net/ae7Ljmc7/
Source: stackoverflow.com
Related Query
- How do you set the stack order of the series in a stacked bar chart?
- Highcharts Bar Chart - How to set the minimum bar width/length
- How to set minimum height of data element of series in stacked bar chart?
- How to show Legends for all the series data in stacked column chart Highcharts?
- How could you supply multiple series to a line chart in R shiny using highcharter package and without hardcoding the series?
- How can I reverse the series order of a pyramid chart in Highcharts
- How to set brightness effects on specific columns on the stacked column/bar chart when using Highcharts?
- How to set different bar width in the same series Highchart
- How can I create a horizontal stacked bar chart with labels on the bars themselves as well as labels above the bars?
- Highcharts: how to maintain the same order of category labels when bar chart changes to column chart
- How to set custom color on stacked bar chart
- How to hide the Axis line in stack bar chart high chart
- Highcharts stacked bar chart - how to get the stacks values
- How do you increase the performance of highcharts chart creation and rendering
- Highcharts - How to set custom colors for the series
- How do you add text to the bottom center of legend and bottom center of chart under legend?
- How do you remove x-axis labels from a highchart.js bar chart
- How to position datalabel at the base of bar series
- In highcharts's stacked bar chart, how can I remove the white space between different
- How can I extend the lines of this Highchart series to the edges of my chart area?
- How do I do a stacked bar chart as a drilldown to a stacked bar chart?
- How to set the x value for High Charts error bar
- Highcharts 3.0, area chart with stacked and unstacked series - how to fix?
- Highcharts: How to provide a custom stack label in highcharts bar graph from within the stackLabel formatter?
- How to use add series and update methods in the high chart wrapper for angular?
- Highcharts- how to set yAxis to the closest or exact value in the series data
- Highcharts: How to set unique images on top of bar chart serie
- How do you set the text-overflow property of a highcharts-legend-item to ellipsis in styled mode?
- How to set series-label to false by default and change the color of series label text in highchart
- highcharts- stacked bar, how can I make the chart cover the width 100%?
More Query from same tag
- How can I read an Excel File with JavaScript (without ActiveXObject)
- Can I with highcharts column stacking on hover not highlighting the whole serie
- BUG? RangeSelector Buttons not working correctly
- Add custom metadata to highchart series
- Sort of series values for xAxis
- Highcharts: Set DPi and resolution for scientific papers
- Position highcharts datalabels to the left of positive bars and to the right of negative bars
- Highcharts: How to provide a custom stack label in highcharts bar graph from within the stackLabel formatter?
- Highchart ctor doesn't return a Chart
- HighChart Renders Blank with Small Data Set
- Highchart show percentage on group column highcharts
- How to draw a Horizontal line using Highcharts DotNet C#
- Dynamic data in Highcharts geomaps
- JS Graphs using positive & negative values (Single line graph)
- Restrict Highchart draggable points
- Highchart treemap color averages out
- Why do these two Highcharts calls produce different windrose charts
- Marking specific point on highchart column
- How to add series after click event in HighCharts
- Converting image response, after post request, to file
- controlling the resolution (dpi) of an exported JPG from highcharts exporting-server
- how to import highcharts with webpack and babel
- Highcharts legend for left and right axis separated
- Highcharts - How can I show arrow in "solidgauge"?
- Heatmap With Custom Data Cannot Display anything
- Highcharts fill serie's color on svg marker
- Cannot implement lazy high chart receiving errors
- Highcharts showing wrong time based on timezone
- Highcharts line chart won't display line chart in IE
- Fixed Datalabel dimensions in Highcharts Series DataLabels