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

Fit ChartView Area to Container

4 Answers 24 Views
This is a migrated thread and some comments may be shown as answers.
Joavn
Top achievements
Rank 1
Joavn asked on 01 Feb 2019, 12:24 PM

Hello, i would like to know if it's possible to resize chart view area to fit container, at the moment whole ChartView is docked to "Fill" for that container but Area has that white border.

Example what i want is shown on image.

 

Thanks in advance.

4 Answers, 1 is accepted

Sort by
0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 01 Feb 2019, 03:05 PM
Hello, Joavn,       

By default, RadChartView there is a margin applied to its view. In order to eliminate it, you can use the following code snippet:

LineSeries lineSeries = new LineSeries();
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);
 
this.radChartView1.ChartElement.View.Margin = new Padding(0);


 

I hope this information helps. 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Joavn
Top achievements
Rank 1
answered on 02 Feb 2019, 09:53 AM

Works great but there's one problem.
I don't wanna show axes so i do radChartView.Axes.Clear();

And gives me that result sadly.
Is there a way to not show axes and to have it streched to fit view?

0
Joavn
Top achievements
Rank 1
answered on 04 Feb 2019, 08:40 AM
I marked your post as answer as it did help in what i needed. Thanks!
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 06 Feb 2019, 08:42 AM
Hello, Joavn,         
 
RadChartView relies on the axes in order to draw the series correctly. That is why instead of clearing the axis, I would recommend just to hide them. This will not break the rending mechanism:

LineSeries lineSeries = new LineSeries();
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);
 
this.radChartView1.ChartElement.View.Margin = new Padding(0);
 
lineSeries.HorizontalAxis.IsVisible = false;
lineSeries.VerticalAxis.IsVisible = false;

Should you have further questions please let me know.

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Asked by
Joavn
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Joavn
Top achievements
Rank 1
Share this question
or