public EChartsComponentToolbox()
 {
     Feature = new Feature();
     TextStyle = null;
     Color = null;
 }
Exemplo n.º 2
0
        /// <summary>
        /// 组件初始化
        /// </summary>
        /// <param name="option"></param>
        private void OptionComponent(Option option)
        {
            EChartsComponentTitle title = new EChartsComponentTitle { Text = "hello World", Subtext = "UglyMelon007" };
            option.Title = title;

            EChartsComponentTooltip tooltip = new EChartsComponentTooltip { Trigger = "axis" };
            option.Tooltip = tooltip;

            EChartsComponentLegend legend = new EChartsComponentLegend();
            LegendData legendData = new LegendData { Name = "最高温度" };
            legend.Data = new[] { legendData };
            option.Legend = legend;

            EChartsComponentAxis xAxis = new EChartsComponentAxis { Type = "category", BoundaryGap = "false" };
            xAxis.Data = new[] {
                new AxisData{Value ="Monday"}, 
                new AxisData{Value ="Tuesday"},
                new AxisData{Value="Wednesday"},
                new AxisData{Value = "Thursday"},
                new AxisData{Value = "Friday"},
                new AxisData{Value = "Saturday"},
                new AxisData{Value = "Sunday"}
            };
            option.XAxis = xAxis;

            EChartsComponentAxis yAxis = new EChartsComponentAxis { Type = "value" };
            AxisLabel axisLabel = new AxisLabel { Formatter = "{value} °C" };
            yAxis.AxisLabel = axisLabel;
            option.YAxis = yAxis;

            EChartsComponentToolbox toolbox = new EChartsComponentToolbox();
            toolbox.Show = "true";
            Feature feature = new Feature();
            Mark mark = new Mark { Show = "true" };
            DataView dataView = new DataView { Show = "true", ReadOnly = "false" };
            MagicType magicType = new MagicType { Show = "true", Type = new[] { "line", "bar" } };
            Restore restore = new Restore { Show = "true" };
            SaveAsImage saveAsImage = new SaveAsImage { Show = "true" };
            feature.Mark = mark;
            feature.DataView = dataView;
            feature.MagicType = magicType;
            feature.Restore = restore;
            feature.SaveAsImage = saveAsImage;
            toolbox.Feature = feature;
            option.Toolbox = toolbox;
        }