Grafik Chart Line using Line Series Set Space Beetween Point YAxes

1 Answer 9 Views
ChartView
Genda
Top achievements
Rank 2
Genda asked on 27 May 2021, 04:37 AM

Hi Everyone , I have some problem for set Space Beetween Point Y, i want to set space look the image,

this is source code

private void DrawRadChartViewLine(RadChartView p_oRadChartView, bool bIsGrey)
        {

            p_oRadChartView.AreaType = ChartAreaType.Cartesian;
            p_oRadChartView.Series.Clear();

            #region Config New Chart Series
            LineSeries series = new LineSeries();
            series.CategoryMember = "MonthName";
            series.ValueMember = "TotalAsset";
            series.DataSource = lDataLine;
            series.PointSize = new SizeF(7, 7);
            series.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
            series.Padding = new Padding(20);
            series.IsVisible = true;            

            p_oRadChartView.Series.Add(series);
            #endregion

            #region Grid Area Formatting

            CartesianArea area = p_oRadChartView.GetArea<CartesianArea>();
            area.ShowGrid = true;

            CartesianGrid grid = area.GetGrid<CartesianGrid>();
            grid.Size = new Size(970, 160);
            grid.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
            grid.DrawHorizontalFills = true;
            grid.DrawHorizontalStripes = true;
            grid.DrawVerticalFills = true;
            grid.DrawVerticalStripes = false;
            grid.ForeColor = Color.FromArgb(239, 229, 216); //228, 210, 190
            grid.Padding = new Padding(15);
            grid.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dot;
            grid.BorderWidth = 3.5f;//2.5f;                 

            if (bIsGrey)
            {
                area.Grid.BackColor = Color.FromArgb(246, 246, 246);
                area.Grid.BackColor2 = Color.FromArgb(246, 246, 246);
                area.Grid.AlternatingBackColor = Color.FromArgb(246, 246, 246);
                area.Grid.AlternatingBackColor2 = Color.FromArgb(246, 246, 246);
            }
            else
            {
                area.Grid.BackColor = Color.FromArgb(252, 249, 247);
                area.Grid.BackColor2 = Color.FromArgb(252, 249, 247);
                area.Grid.AlternatingBackColor = Color.FromArgb(252, 249, 247);
                area.Grid.AlternatingBackColor2 = Color.FromArgb(252, 249, 247);
            }


            #endregion
        }

 

i hope someone in this forum can help me..

thanky,, Regards Genda..

 

 

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 27 May 2021, 08:53 AM
Hello, Genda,

According to the provided screenshot, it seems that the ticks on the horizontal axis are aligned with the respective data points. However, you need the ticks to be rendered between the data points.

I suppose that you are using a CategoricalAxis. It offers the PlotMode property which determines the AxisPlotMode used to by the axis to plot the data. Possible values are BetweenTicks, OnTicks, OnTicksPadded. BetweenTicks plots points in the middle of the range, defined by two ticks. OnTicks plots the points over each tick. OnTicksPadded plots points over each tick with half a step padding applied on both ends of the axis. I would recommend you to use AxisPlotMode.BetweenTicks. Additional information about the axis is available in the following help article: https://docs.telerik.com/devtools/winforms/controls/chartview/axes/categorical 

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
ChartView
Asked by
Genda
Top achievements
Rank 2
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or