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

Set horizontal align style on RadLegendView

1 Answer 49 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.
nico
Top achievements
Rank 1
nico asked on 03 Nov 2014, 10:50 AM
Hello,

I would like to know how I can show a RadLegendView in a horizontal align mode, by default it's in vertical align.

In a second time, I would like to put one LegendTitle on the right and a second one on the left of the screen, because I use only two VerticalAxis, one on the right and one on the left, is it possible ?

My code:

for(....) {
   LineSeries lineSeries = new LineSeries();
   lineSeries.setLegendTitle("myText");
   chartView.getSeries().add(lineSeries);
}

RadLegendView legendView = new RadLegendView(this);
legendView.setLegendProvider(this.chartView);

LinearLayout linearLayout = new LinearLayout(this);
linearLayout.setOrientation(LinearLayout.VERTICAL);

linearLayout.addView(legendView);
linearLayout.addView(chartView);

ViewGroup rootView = (ViewGroup)findViewById(R.id.chartContainer);
rootView.addView(linearLayout);


Thanks!

1 Answer, 1 is accepted

Sort by
0
Victor
Telerik team
answered on 06 Nov 2014, 08:25 AM
Hello Nico,

Thanks for writing.
In the current version the legend is based on the Android ListView. Unfortunately the list does not provide many customization options. We can expose the list view adapter but this still won't allow horizontal or other more specific layouts. We will revise the internals of the legend and provide a more flexible API in a future release.

Fortunately the legend is extremely simple at the moment and you can implement it manually fairly quickly. Just create a list view and pass it an adapter that translates from a chart series to a list view item. Then you can use the chart series collection itself.

Please write again if you have more questions.

Regards,
Victor
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
nico
Top achievements
Rank 1
Answers by
Victor
Telerik team
Share this question
or