Exemple #1
0
        private static void ExportSeries(StringBuilder sb, BaseChart chart)
        {
            var instanceId = chart.GetInstanceID();

            for (int i = 0; i < chart.series.list.Count; i++)
            {
                var serie = chart.series.GetSerie(i);
                var key   = "serie_" + i;
                AppendColor(sb, instanceId, key + "_itemStyle", serie.itemStyle.color, serie.itemStyle.toColor, serie.itemStyle.toColor2, serie.itemStyle.backgroundColor, serie.itemStyle.borderColor);
                AppendColor(sb, instanceId, key + "_label", serie.label.backgroundColor, serie.label.borderColor);
                AppendColor(sb, instanceId, key + "_itemStyleEmphasis", serie.emphasis.itemStyle.color, serie.emphasis.itemStyle.toColor, serie.emphasis.itemStyle.toColor2, serie.emphasis.itemStyle.backgroundColor, serie.emphasis.itemStyle.borderColor);
                AppendColor(sb, instanceId, key + "_labelEmphasis", serie.emphasis.label.backgroundColor, serie.emphasis.label.borderColor);
                if (serie.type == SerieType.Line)
                {
                    AppendColor(sb, instanceId, key + "_lineStyle", serie.lineStyle.color);
                    AppendColor(sb, instanceId, key + "_areaStyle", serie.areaStyle.color, serie.areaStyle.toColor, serie.areaStyle.highlightColor, serie.areaStyle.highlightToColor);
                }
                if (serie.type == SerieType.Gauge)
                {
                    var axisLineColors = new List <Color>();
                    axisLineColors.Add(serie.gaugeAxis.axisLine.barColor);
                    axisLineColors.Add(serie.gaugeAxis.axisLine.barBackgroundColor);
                    for (int n = 0; n < serie.gaugeAxis.axisLine.stageColor.Count; n++)
                    {
                        axisLineColors.Add(serie.gaugeAxis.axisLine.stageColor[n].color);
                    }
                    AppendColor(sb, instanceId, key + "_gaugeAxisLine", axisLineColors);
                    AppendColor(sb, instanceId, key + "_gaugeSplitLine", serie.gaugeAxis.splitLine.lineStyle.color);
                    AppendColor(sb, instanceId, key + "_gaugeAxisTick", serie.gaugeAxis.axisTick.lineStyle.color);
                }
                for (int j = 0; j < serie.dataCount; j++)
                {
                    key = string.Format("serieData_{0}_{1}", i, j);
                    var serieData = serie.GetSerieData(j);
                    if (serieData.enableItemStyle)
                    {
                        AppendColor(sb, instanceId, key + "_itemStyle", serieData.itemStyle.color, serieData.itemStyle.toColor, serieData.itemStyle.toColor2, serieData.itemStyle.backgroundColor, serieData.itemStyle.borderColor);
                    }
                    if (serieData.enableLabel)
                    {
                        AppendColor(sb, instanceId, key + "_label", serieData.label.backgroundColor, serieData.label.borderColor);
                    }
                    if (serieData.enableEmphasis)
                    {
                        AppendColor(sb, instanceId, key + "_itemStyleEmphasis", serieData.emphasis.itemStyle.color, serieData.emphasis.itemStyle.toColor, serieData.emphasis.itemStyle.toColor2, serieData.emphasis.itemStyle.backgroundColor, serieData.emphasis.itemStyle.borderColor);
                    }
                    if (serieData.enableEmphasis)
                    {
                        AppendColor(sb, instanceId, key + "_labelEmphasis", serieData.emphasis.label.backgroundColor, serieData.emphasis.label.borderColor);
                    }
                }
            }
        }