This is a migrated thread and some comments may be shown as answers.

Setting Grid Dot Size and Add Margin or Space in first Chart Value

1 Answer 151 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Mozart
Top achievements
Rank 1
Iron
Veteran
Mozart asked on 16 Oct 2020, 04:45 AM

Hello, i have a Line Chart that needed to do some formatting.What i want is to change the thickness of Grid Dot Size and add a little margin / padding on first Chart Value.  Please see attachment to see the details.

1 Answer, 1 is accepted

Sort by
0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 20 Oct 2020, 11:20 AM
Hello, Mozart, 

The CategoricalAxis.PlotMode property 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. 
            LineSeries lineSeries = new LineSeries();
            lineSeries.CombineMode = ChartSeriesCombineMode.Stack;
            lineSeries.DataPoints.Add(new CategoricalDataPoint(20, "Jan"));
            lineSeries.DataPoints.Add(new CategoricalDataPoint(22, "Apr"));
            lineSeries.DataPoints.Add(new CategoricalDataPoint(12, "Jul"));
            lineSeries.DataPoints.Add(new CategoricalDataPoint(19, "Oct"));
            this.radChartView1.Series.Add(lineSeries); 
            CategoricalAxis horizontalAxis = lineSeries.HorizontalAxis as CategoricalAxis;
            if (horizontalAxis != null)
            {
                horizontalAxis.PlotMode = AxisPlotMode.BetweenTicks; 
            }

As to the dots on the grid lines, you can set the CartesianGrid.BorderWidth property to the desired value:

            CartesianArea area = this.radChartView1.GetArea<CartesianArea>();
            area.ShowGrid = true;
            CartesianGrid grid = area.GetGrid<CartesianGrid>();
            grid.DrawHorizontalFills = false;
            grid.DrawVerticalStripes = false;
            grid.BorderWidth = 3;
            grid.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dot;


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

Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive, special prizes, and more, for FREE?! Register now for DevReach 2.0(20).

Tags
ChartView
Asked by
Mozart
Top achievements
Rank 1
Iron
Veteran
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or