예제 #1
0
        public static void ApplyChartStyles(ChartControl chart)
        {
            #region ApplyCustomPalette
            chart.Skins = Skins.Metro;
            #endregion

            #region chart appearance customization
            chart.ShowLegend = false;
            chart.BorderAppearance.SkinStyle      = Syncfusion.Windows.Forms.Chart.ChartBorderSkinStyle.None;
            chart.BorderAppearance.FrameThickness = new ChartThickness(-2, -2, 2, 2);
            chart.PrimaryXAxis.DrawGrid           = false;
            #endregion

            #region Chart axes customization
            chart.PrimaryXAxis.TickSize = new System.Drawing.Size(1, 5);
            chart.PrimaryYAxis.TickSize = new System.Drawing.Size(5, 1);
            chart.LegendsPlacement      = ChartPlacement.Outside;
            #endregion

            #region Legend Customization
            //Adds Custom legend to chart control
            ChartLegend legend1 = new ChartLegend(chart);
            legend1.Name = "legend1";
            legend1.RepresentationType = ChartLegendRepresentationType.None;
            legend1.Position           = ChartDock.Bottom;
            legend1.Alignment          = ChartAlignment.Center;
            ChartLegendItem[]          customItems = new ChartLegendItem[0];
            ChartLegendItemsCollection clic        = new ChartLegendItemsCollection();
            ChartLegendItem            cli1        = new ChartLegendItem("Press Esc to Cancel Zooming");
            clic.Add(cli1);
            legend1.CustomItems = clic.ToArray();
            chart.Legends.Add(legend1);
            #endregion
        }
예제 #2
0
        private void InitializeControlSettings()
        {
            ChartLegend legend1 = new ChartLegend(chartControl1);

            legend1.Name               = "legend1";
            legend1.ColumnsCount       = 1;
            legend1.RowsCount          = 1;
            legend1.RepresentationType = ChartLegendRepresentationType.None;
            legend1.ShowSymbol         = false;
            legend1.Position           = ChartDock.Bottom;
            legend1.Alignment          = ChartAlignment.Center;

            ChartLegendItem[]          customItems = new ChartLegendItem[0];
            ChartLegendItemsCollection clic        = new ChartLegendItemsCollection();
            ChartLegendItem            cli1        = new ChartLegendItem("That follows a series point");

            cli1.Type               = ChartLegendItemType.Circle;
            cli1.Border.Color       = Color.Transparent;
            cli1.RepresentationSize = new Size(8, 8);
            cli1.Interior           = new BrushInfo(Color.FromArgb(0Xc1, 0X39, 0x2b));
            clic.Add(cli1);

            ChartLegendItem cli2 = new ChartLegendItem("That uses chart coordinates");

            cli2.Type = ChartLegendItemType.InvertedTriangle;
            cli2.RepresentationSize = new Size(8, 8);
            cli2.Interior           = new BrushInfo(Color.FromArgb(0Xfc, 0Xec, 0X29));
            clic.Add(cli2);

            ChartLegendItem cli3 = new ChartLegendItem("That follows a percent type");

            cli3.Type = ChartLegendItemType.Pentagon;
            cli3.RepresentationSize = new Size(8, 8);
            cli3.Interior           = new BrushInfo(Color.FromArgb(0X00, 0X66, 0Xcc));
            clic.Add(cli3);

            ChartLegendItem cli4 = new ChartLegendItem("That follows a pixel type");

            cli4.Type = ChartLegendItemType.Triangle;
            cli4.RepresentationSize = new Size(8, 8);
            cli4.Interior           = new BrushInfo(Color.FromArgb(0X00, 0Xce, 0X45));
            clic.Add(cli4);

            legend1.CustomItems = clic.ToArray();
            chartControl1.Legends.Add(legend1);
            chartControl1.ShowToolTips = true;
        }
예제 #3
0
        public static void ApplyChartStyles(ChartControl chart)
        {
            #region chart Skin
            chart.Skins = Skins.Metro;
            #endregion

            #region Chart Appearance Customization
            chart.BorderAppearance.SkinStyle      = Syncfusion.Windows.Forms.Chart.ChartBorderSkinStyle.None;
            chart.BorderAppearance.BaseColor      = Color.DarkOliveGreen;
            chart.BorderAppearance.FrameThickness = new ChartThickness(-2, -2, 2, 2);
            chart.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
            chart.ChartArea.PrimaryXAxis.HidePartialLabels = true;
            chart.ElementsSpacing = 5;

            #endregion

            #region Axes Customization

            chart.PrimaryXAxis.HidePartialLabels = true;
            chart.PrimaryYAxis.HidePartialLabels = true;
            chart.Zooming.ShowBorder             = true;
            chart.Zooming.Opacity = 0.6f;
            chart.GetVScrollBar(chart.PrimaryYAxis).ZoomButton.Size = new Size(0, 0);
            chart.GetHScrollBar(chart.PrimaryXAxis).ZoomButton.Size = new Size(0, 0);
            chart.EnableXZooming                     = true;
            chart.EnableYZooming                     = true;
            chart.ZoomFactorX                        = 1;
            chart.ZoomFactorX                        = 1;
            chart.ShowScrollBars                     = true;
            chart.ResetOnDoubleClick                 = true;
            chart.ZoomType                           = ZoomType.Selection | ZoomType.PinchZooming;
            chart.SmoothingMode                      = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
            chart.PrimaryXAxis.Title                 = "Year";
            chart.PrimaryYAxis.Title                 = "Temperature";
            chart.PrimaryXAxis.Range                 = new Syncfusion.Windows.Forms.Chart.MinMaxInfo(1850, 2007, 40);
            chart.PrimaryXAxis.RangeType             = Syncfusion.Windows.Forms.Chart.ChartAxisRangeType.Set;
            chart.PrimaryXAxis.LabelIntersectAction  = ChartLabelIntersectAction.MultipleRows;
            chart.PrimaryXAxis.EdgeLabelsDrawingMode = ChartAxisEdgeLabelsDrawingMode.Shift;

            #endregion

            #region Legend Customization
            for (int i = 0; i < chart.Legend.Items.Length; i++)
            {
                chart.Legend.Items[i].Spacing      = 4;
                chart.Legend.ItemsSize             = new Size(13, 13);
                chart.Legend.Items[i].TextAligment = VerticalAlignment.Bottom;
                chart.Legend.BackColor             = Color.Transparent;
                chart.LegendsPlacement             = ChartPlacement.Outside;
                chart.LegendAlignment = ChartAlignment.Center;
                chart.LegendPosition  = ChartDock.Bottom;
                chart.Legend.Font     = new Font("Segoe UI", 10.25f);
            }

            //Adds Custom legend to chart control

            ChartLegendItem[]          customItems = new ChartLegendItem[0];
            ChartLegendItemsCollection clic        = new ChartLegendItemsCollection();
            ChartLegendItem            cli1        = new ChartLegendItem("Press Esc to Cancel Zooming");
            clic.Add(cli1);


            #endregion
        }