예제 #1
0
        private CaisisChart GetChartPrototype()
        {
            CaisisChart c = new CaisisChart();

            c.Width  = 550;
            c.Height = 200;

            c.BorderlineDashStyle = ChartDashStyle.Solid;
            c.BackColor           = Color.FromArgb(0xFF, 0xFF, 0xFF);


            // legend
            Legend legend1 = new Legend("Legend1");

            legend1.Enabled = false;

            c.Legends.Add(legend1);


            // series
            SmartLabelStyle labelStyle = new SmartLabelStyle();

            labelStyle.Enabled = true;
            labelStyle.CalloutLineAnchorCapStyle = LineAnchorCapStyle.None;
            labelStyle.CalloutStyle = LabelCalloutStyle.None;

            Series series = new Series("Series1");

            series.ChartType           = SeriesChartType.Line;
            series.Color               = Color.FromArgb(0xC4, 0x3E, 0x06);
            series.Legend              = "Legend1";
            series.XValueMember        = "Months";
            series.YValueMembers       = "Score";
            series.IsValueShownAsLabel = true;
            series.LabelForeColor      = Color.FromArgb(0xC4, 0x3E, 0x06);
            series.SmartLabelStyle     = labelStyle;
            series.MarkerStyle         = MarkerStyle.Circle;
            series.MarkerSize          = 4;

            c.Series.Add(series);


            // chart area
            ChartArea chartArea = new ChartArea();

            chartArea.BackSecondaryColor = Color.White;
            chartArea.BackColor          = Color.AliceBlue;
            chartArea.ShadowColor        = Color.Transparent;
            chartArea.BackGradientStyle  = GradientStyle.TopBottom;

            c.ChartAreas.Add(chartArea);

            return(c);
        }
예제 #2
0
        private void TemperatureConditionChart(Chart chart)
        {
            ChartController.Clear(chart);
            string temperatureSeries = "T, °C";

            ChartController.AddSeries(chart, temperatureSeries, SeriesChartType.Area, Color.CornflowerBlue);
            _weatherController.TemperatureCondition(_weathers, out var dates, out var temperatures);
            ChartController.Fill(chart, temperatureSeries, dates, temperatures);
            ChartController.AxisTitles(chart, "дата", "T, °C");
            SmartLabelStyle smartLabel = new SmartLabelStyle
            {
                AllowOutsidePlotArea       = LabelOutsidePlotAreaStyle.Partial,
                IsMarkerOverlappingAllowed = true
            };

            chart.Series[0].SmartLabelStyle = smartLabel;
        }