Uploaded image for project: 'ZK Charts'
  1. ZK Charts
  2. ZKCHARTS-5

Set theme will cause js error in IE8

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 1.1.0
    • 1.0.0
    • None

      Workaround: add the following code to zul, then import and use MyTheme instead of Theme

      <script><![CDATA[
      zk.afterLoad('chart', function () {
      
      	function _convertGlobalOptions(options, plotData) {
      		options = options || {};
      		var global = options.global = options.global || {};
      		if (!global.VMLRadialGradientURL) {
      			global.VMLRadialGradientURL = zk.ajaxURI('web/js/chart/ext/gfx/vml-radial-gradient.png', {au:true});
      		}
      		if (!global.canvasToolsURL) {
      			global.canvasToolsURL = zk.ajaxURI('web/js/chart/ext/modules/canvas-tools.js', {au:true});
      		}
      
      		if (plotData.chart && plotData.chart.style)
      			options.chart = {
      				style: plotData.chart.style
      			};
      		return options;
      	}
      	
      	var DefaultOptions = jq.extend(true, {}, Highcharts.getOptions());
      	function resetOptions() {
      		var options = Highcharts.getOptions();
      		for (var key in options) {
      			if (typeof options[key] !== 'function')
      				delete options[key];
      		}
      		Highcharts.setOptions(DefaultOptions);
      	}
      	
      	zk.override(chart.Charts.prototype, 'bind_', function () {
      		this.$supers(chart.Charts,'bind_', arguments);
      		if (this.plotData) {
      			var plotData = this._convertAttrs(this.plotData);
      			Highcharts.setOptions(_convertGlobalOptions(this._options, plotData));
      
      			if (this._theme) {
      				resetOptions();
      				if (this._theme != 'DefaultTheme')
      					Highcharts.setOptions(this._theme);
      			}
      			this.engine = new Highcharts.Chart(plotData);
      		}
      	});
      });
      ]]></script>
      

            Unassigned Unassigned
            RaymondChao RaymondChao
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: