2013-05-10 61 views
1

如何在我應用某個主題後將我的主題恢復爲Highcharts中的默認主題?將主題恢復爲默認

我試過這個,但不起作用。

Highcharts.theme = { 
}; 
var highchartsOptions = Highcharts.setOptions(Highcharts.theme); 

我也嘗試瞭解決方案描述here

移除所有的從下面的代碼的色彩選擇和重裝 的Highcharts對象將使其默認爲基本主題

...但它也不起作用。

感謝

回答

2

Unforunately你需要覆蓋默認值的所有顏色/參數的第二個圖表。

http://jsfiddle.net/WNGpQ/2/

var theme = { 
    colors: ['#2f7ed8', '#0d233a', '#8bbc21', '#910000', '#1aadce', '#492970', 
     '#f28f43', '#77a1e5', '#c42525', '#a6c96a'], 
    chart: { 
     backgroundColor: '#fff', 
     borderWidth: 0, 
     plotBackgroundColor: '#fff', 
     plotShadow: false, 
     plotBorderWidth: 0 
    }, 
    title: { 
     style: { 
      color: '#274b6d',//#3E576F', 
      fontSize: '16px' 
     } 
    }, 
    subtitle: { 
     style: { 
      color: '#4d759e' 
     } 
    }, 
    xAxis: { 
     gridLineWidth: 0, 
     lineColor: '#C0D0E0', 
     tickColor: '#C0D0E0', 
     labels: { 
     style: { 
      color: '#666', 
      cursor: 'default', 
      fontSize: '11px', 
      lineHeight: '14px' 
     } 
     }, 
     title: { 
     style: { 
       color: '#4d759e', 
       fontWeight: 'bold' 
     } 
     } 
    }, 
    yAxis: { 
     minorTickInterval: null, 
     lineColor: '#C0D0E0', 
     lineWidth: 1, 
     tickWidth: 1, 
     tickColor: '#C0D0E0', 
     labels: { 
     style: { 
      color: '#666', 
      cursor: 'default', 
      fontSize: '11px', 
      lineHeight: '14px' 
     } 
     }, 
     title: { 
     style: { 
       color: '#4d759e', 
       fontWeight: 'bold' 
     } 
     } 
    }, 
    legend: { 
     itemStyle: { 
      color: '#274b6d', 
      fontSize: '12px' 
     }, 
     itemHoverStyle: { 
     color: '#000' 
     }, 
     itemHiddenStyle: { 
     color: '#CCC' 
     } 
    }, 
    labels: { 
     style: { 
      color: '#3E576F' 
     } 
    }, 

    navigation: { 
     buttonOptions: { 
     theme: { 
      stroke: '#CCCCCC' 
     } 
     } 
    } 
}; 
+0

你有樣的色彩,將恢復到默認? – MaVRoSCy 2013-05-13 10:21:21

+0

@MaVRoSCy看看更新後的答案 – 2013-05-13 11:58:15

+0

太棒了!謝謝 – MaVRoSCy 2013-05-13 12:13:40