score:7
Accepted answer
this issue is the capitalization of our drop-down values. changed the check to do:
newtype = newtype.tolowercase();
now chart type changes great take effect. full code:
function changetype(chart, series, newtype) {
newtype = newtype.tolowercase();
for (var i = 0; i < series.length; i++) {
series = series[0];
try {
series.chart.addseries({
type: newtype,
stack: series.stack,
yaxis: series.yaxis,
name: series.name,
color: series.color,
data: series.options.data
},
false);
series.remove();
} catch (e) {
alert(newtype & ': ' & e);
}
}
}
score:0
for anyone that stumbles accross this... you must remove the chart series' from last to first. also remember to redraw on the last series or your changes will not be displayed:)
function changecharttype(chart, type, redraw) {
var seriesoptions = new array(chart.series.length);
for (var i = 0; i < chart.series.length; i++) {
var series = chart.series[i];
seriesoptions[i] = {
type: type,
name: series.name,
color: series.color,
dashstyle: series.options.dashstyle,
linewidth: series.options.linewidth,
marker: series.options.marker,
datalabels: series.options.datalabels,
enablemousetracking: series.options.enablemousetracking,
data: series.options.data,
isregressionline: series.options.isregressionline
};
}
for (var i = chart.series.length - 1; i >= 0; i--) {
chart.series[i].destroy();
}
for (var i = 0; i < seriesoptions.length; i++) {
var newseries = chart.addseries(seriesoptions[i], redraw && i == seriesoptions.length - 1);
}
chart.currenttype = type;
}
Source: stackoverflow.com
Related Query
- HighCharts Dynamically Change Chart Type
- Highcharts - Dynamically change chart type with on radio buttons click
- Highcharts (9.0.1): drilldown problem after change chart type dynamically
- highcharts jquery dynamic change chart type column to bar
- Change chart type and redraw with multiple series in Highcharts
- how to dynamically change chart type in highstock stock chart?
- highcharts change chart type using dropdown for multiple series
- Pie chart Slice color Change Dynamically in Highcharts
- Highcharts - Pie Chart change slice colors dynamically
- Highchart, dynamically change the chart type
- Highcharts change chart type on drop down Jquery
- change particular line chart series colour dynamically in highcharts
- Highcharts : Change spline chart color dynamically
- How to change scrollbar position when switching chart type in highcharts
- Can not access Highcharts chart from container, so I can't change data in a chart dynamically
- Add a dropdown to Highcharts to change chart type with AngularJs
- Programmatically change a chart title in highcharts
- Highcharts : Change opacity of a column chart
- How do I dynamically change a data point in Highcharts using JavaScript
- Change Highcharts tooltip formatter from chart Object , after chart is rendered
- Highcharts dynamically change bar color based on value
- Changing Highcharts data series type dynamically
- Highcharts pie chart dynamically changes size
- Dynamically update Highcharts chart in react
- Change series data dynamically in react-highcharts without re-render of the chart
- Change color of area chart programmatically in highcharts
- Which chart type should i choose to show change in values between 2 dates?
- Highcharts Donut Chart text in center change on hover
- Highcharts, Can you change the chart type for drilldowns?
- Issue Dynamically Changing HighCharts Chart Title
More Query from same tag
- Line Chart using array
- Highcharts solid gauge, show colors of previous stops in gauge
- how to divide two columns on series with json in highchart
- how do you call getJSON inside the highchart section
- How to get categories from a database for highcharts using codeigniter
- Highcharts :Rendering only Percentage Bar Using type: 'xrange'
- HighCharts Plotlines with Multiple Y-Axis
- Display label stack Label in Highcharts
- Multiple group_by shiny app making a plot
- Highcharts x-axis label
- Charts not responding on the web page after printing them
- HighCharts: Annotation on X axis?
- DateTime xAxis Label Not Displaying Correct
- Make a choropleth from a non-highmap-collection map
- Highchart download image is changing aspect ratio
- Animating Highcharts Columns with series.addPoint()
- Highcharts Grouped stack x.axis name + category name
- Is there some way to only show the PNG option in exporting.csv?
- HighCharts plugin JQuery
- How to display the collection in the library dynamically Highcharts - Bind collection with Highcharts in MVC
- Inner area color for pie-donut highchart
- Highcharts - legend titles rotation is not working fine in IE10
- OnClick() with Highcharts in MVC 4
- how to fix '-1' value displaying while clicked on navigator in highchart ? (When date-range not used for navigator)
- Highchart hide series element with xAxis
- Testing Highcharts with protractorjs/Selenium
- Highcharts - prevent accessing of points out of extremes
- Can i show table on x-axis as like grouped categories in highcharts - But no grouping
- Highcharts, 5 small charts some randomly not drawing
- Area Chart with overlapping series in highcharts, overlap point behaving strangely