2013-05-10 60 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