3

I am using highcharts and the colors keeps changing when i refresh the chart with different data. Here is my theme object:

Highcharts.theme = {
    colors: [
        // Main Colours
        /* '#1E73AA', '#C44441', '#55BF3B', '#7A5992',
        '#009AB2', '#F08736', '#8EAACF', '#CE7057', '#737373' */
        '#2691d9','#cf6563','#79cf63','#9d81b1','#33e4ff','#f39b58','#a6bcd9','#d78a75','#a6a6a6'
   ],
    legend: {
        itemStyle: {
            font: '9pt Trebuchet MS, Verdana, sans-serif',
            color: 'black'
        },
        itemHoverStyle:{
            color: 'gray'
        }   
    },
    lang: {
        decimalPoint: ',',
        thousandsSep: ' '
    }
};

// Apply the theme:
Highcharts.setOptions(Highcharts.theme);

It chooses the colors from the which i have provided but it keeps choosing dynamically. The default behavior of highcharts is to select the first color for first series all the time if there is second series then it should select second color from theme.

Here is the fiddle with just highcharts: http://jsfiddle.net/sffnk2k1/ Here is the fiddle with highcharts and ng-highcharts: http://jsfiddle.net/Lurau4s7/

Many thanks in advance.

arsinawaz
  • 480
  • 1
  • 6
  • 18
  • 4
    It looks like the difference is that the regular version is destroying the chart completely and building a new one, which will cause the series to use the first color - but the ng-version is not entirely destroying the chart, which causes each iteration to increment the series counter, and choose the next color. First thing I would do is use a smarter way to update your chart! there are a lot of built in functions to help with this. – jlbriggs Feb 18 '16 at 15:18
  • It's been answered here http://stackoverflow.com/questions/17802509/how-can-i-reset-the-styles-given-to-series-in-highcharts – Aximili Oct 13 '16 at 03:26

0 Answers0