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

How to fix plot area width and yAxis position

3 Answers 125 Views
Chart
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
EY
Top achievements
Rank 2
EY asked on 04 Dec 2014, 05:34 PM
I have a TKChartAreaSeries and implemented data source protocol.
I can display the chart and change its datapoints by using a segmented button and reloading the chart.

As I change the datapoints using the segmented button and reload the chart, yAxis item labels resize themselves horizontally (increase or decrease widths considering the value they are going to display) and yAxis position gets changed. 
So the does the plot area. Its size increases or decreases horizontally following yAxis position.

What I want is to have fixed yAxis position and plot area size, no matter what datapoints it displays.

Actually I can achieve that behaviour by using TKChartLineSeries instead of TKChartAreaSeries, but it is not possible to fill under the line with a color as in TKChartAreaSeries.

So, I need a way to fix plot area size and y axis position for TKChartAreaSeries, or a way to fill under the TKChartLineSeries with a color.


And is there a setting axis item label positions. I don't mean axis' own title label. I mean axis item labels (major, minor) and positioning them on the left side of the yAxis or the right side. The same goes for the xAxis positioning below or above.

3 Answers, 1 is accepted

Sort by
0
Adrian
Telerik team
answered on 05 Dec 2014, 01:41 PM
Hi Erkan,

The easiest way to have fixed axis that is not dependant on its ticks width is to align the axis line on the outer side of the chart and the axis labels on the inner side. This can be achieved by using textAlignment property of TKChartAxisLabelStyle. This property is responsible for aligning the labels on left or right side of the y axis and above or below the x axis. The code snippet below shows how to align the labels on the right side of left position y axis, so that the axis position will always be fixed:
_chart.yAxis.style.labelStyle.textAlignment = TKChartAxisLabelAlignmentRight;

Here is an example how to align the x axis labels above the axis:
_chart.xAxis.style.labelStyle.textAlignment = TKChartAxisLabelAlignmentTop;

I hope this helps. If you have further questions, I will be glad to assist you.

Regards,
Adrian
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
EY
Top achievements
Rank 2
answered on 05 Dec 2014, 02:30 PM
Thanks, it kinda works.

Can I achieve the same when the labels are on the left side of the axis.
I don't want that labels to resize in width, they should have fix size and position and adjust their font size regarding their value.

Is it possible?

I had a look at TKChartAxisLabelFitMode's but there is not an option like AutoResizeFont, only Rotate and MultiLine.

0
Adrian
Telerik team
answered on 08 Dec 2014, 12:30 PM
Hi Erkan,

Currently axis labels do not support this functionality. I logged your suggestion in our feedback portal and we will consider implementing it in a future version. Feel free to vote/comment the issue. I updated also your Telerik points for this suggestion.

If you have other questions, I will be glad to help.

Regards,
Adrian
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Chart
Asked by
EY
Top achievements
Rank 2
Answers by
Adrian
Telerik team
EY
Top achievements
Rank 2
Share this question
or