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

Charts being cropped left and right, do not display properly

4 Answers 153 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
George
Top achievements
Rank 1
George asked on 09 Apr 2015, 06:31 AM

Hi, I have a problem with charts not being displayed properly and being cropped to the left and right edges as the attached picture suggests. The code I use to construct the chart is as follows:

this.radChart.View.Margin = new Padding(15);
ChartTooltipController toolTipController = new ChartTooltipController();
toolTipController.DataPointTooltipTextNeeded += toolTipController_DataPointTooltipTextNeeded;
this.radChart.Controllers.Add(toolTipController);
this.radChart.ShowToolTip = true;
this.radChart.ShowPanZoom = true;
 
LineSeries dailySeries = new LineSeries();
dailySeries.BorderColor = Color.DarkBlue;
dailySeries.BorderWidth = 1;
dailySeries.PointSize = new SizeF(5, 5);
dailySeries.ShowLabels = true;
 
foreach (var r in (from q in DailyData orderby q.FIXING_DATE select q))
{
    dailySeries.DataPoints.Add(new CategoricalDataPoint(r.FIXING, r.FIXING_DATE) { Label = "old" });               
}
             
DateTimeCategoricalAxis categoricalAxis = new DateTimeCategoricalAxis();
categoricalAxis.DateTimeComponent = DateTimeComponent.Date;
categoricalAxis.MajorTickInterval = 21;
categoricalAxis.PlotMode = AxisPlotMode.OnTicks;
categoricalAxis.LabelFitMode = AxisLabelFitMode.MultiLine;
categoricalAxis.LabelFormat = "{0:MMM-yy}";
 
CartesianArea area = this.radChart.GetArea<CartesianArea>();
area.ShowGrid = true;
CartesianGrid grid = area.GetGrid<CartesianGrid>();
grid.DrawHorizontalFills = true;
grid.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.DashDot;
 
//First assign the axis to the VerticalAxis property and then add the series to the chart
dailySeries.HorizontalAxis = categoricalAxis;           
 
this.radChart.Series.Add(dailySeries);
 

Can you pleaase suggest a solution to this problem?

 

Regards,

 

George

4 Answers, 1 is accepted

Sort by
0
Accepted
Stefan
Telerik team
answered on 10 Apr 2015, 10:30 AM
Hello George,

Thank you for writing.

The DateTimeCategoricalAxis has a functionality to clip its labels to the size of the axis and this functionality is turned on my default. To turn it off, just set the following property:
categoricalAxis.ClipLabels = false;

More information about this axis is available here: http://www.telerik.com/help/winforms/chartview-axes-datetime.html.

I hope that you find this information useful. Should you have any other questions, do not hesitate to contact us.

Regards,
Stefan
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
George
Top achievements
Rank 1
answered on 10 Apr 2015, 10:40 AM
Thanks Stefan.
0
George
Top achievements
Rank 1
answered on 10 Apr 2015, 11:12 AM

Sorry for coming back, but just noticed the problem persists, althaugh it partially solves the issue.

On one hand it solves the label problem that were being cropped, but on the chart body it has no effect. As you can see on the attached picture of my chart I have defined the last point of the lineseries to be of size 10X10, but it is being cropped from view. Can you pls propose a solution that also adreeses this issue?

 

Regards,

 

George

 

0
Dimitar
Telerik team
answered on 14 Apr 2015, 02:25 PM
Hello George,

Thank you for writing back.

Please note that in this case the last label visibility depends on the MajorTickInterval as well. So if there are enough data points the last label will be visible. For example if you have 100 data points and if you set the MajorTickInterval to 9 the last label will be visible.

I have logged this case in our Feedback Portal and our developers will take a look at it and determine if this can be improved. You can track the item for status changes and add your vote for it here.

Your Telerik Points have been updated for this report.

Should you have any other questions do not hesitate to ask.

 
Regards,
Dimitar
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
Tags
ChartView
Asked by
George
Top achievements
Rank 1
Answers by
Stefan
Telerik team
George
Top achievements
Rank 1
Dimitar
Telerik team
Share this question
or