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

What order to set data/series/label design

4 Answers 31 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.
Richard
Top achievements
Rank 1
Richard asked on 15 May 2015, 07:34 PM

I have the following code

 

BarSeries weekBarSeries = new BarSeries();
weekBarSeries.setCategoryBinding(new PropertyNameDataPointBinding("DayOfWeek"));
weekBarSeries.setValueBinding(new PropertyNameDataPointBinding("EnrollmentCount"));
weekBarSeries.setDataPointRenderer(new CustomBarChartRenderer(weekBarSeries, WEEK_SERIES_COLORS));
weekBarSeries.setData(oneWeek);
 
weekBarSeries.setShowLabels(true);
weekBarSeries.setLabelFillColor(Color.TRANSPARENT);
weekBarSeries.setLabelStrokeColor(Color.TRANSPARENT);
weekBarSeries.setLabelTextColor(0xff84cc28);
 
weekChartView.getSeries().add(weekBarSeries);
 
CategoricalAxis weekHorizontalAxis = new CategoricalAxis();
weekChartView.setHorizontalAxis(weekHorizontalAxis);
 
LinearAxis weekVerticalAxis = new LinearAxis();
weekVerticalAxis.setLabelFormat("%2.0f");
 
weekChartView.setVerticalAxis(weekVerticalAxis);
 
upTitle.setText(DESApplication.getInstance().getCustomString("screen_02_chart1_title"));
 
upper.addView(weekChartView);

However, the style of the labels remains the same as the default style - light blue boxes with white text.

 

Rich

 

 

 

4 Answers, 1 is accepted

Sort by
0
Richard
Top achievements
Rank 1
answered on 15 May 2015, 07:38 PM

Does the custom data point renderer have to implement anything to handle the custom label attributes?

The code for that renderer is code you gave me to implement a multi colored bar chart.

Rich

0
Richard
Top achievements
Rank 1
answered on 15 May 2015, 07:43 PM

Removing the call to the custom data point renderer made no difference. It appears this code has no effect

 

weekBarSeries.setShowLabels(true);
weekBarSeries.setLabelFillColor(Color.TRANSPARENT);
weekBarSeries.setLabelStrokeColor(Color.TRANSPARENT);
weekBarSeries.setLabelTextColor(0xff84cc28);

 Rich

 

0
Victor
Telerik team
answered on 18 May 2015, 11:25 AM
Hi Richard,

By default the chart gets its colors from the chart palettes. This means that any inline settings will be overwritten by the palettes. You have to either edit the current palette itself, or disable the palettes and then make your inline settings. You can read about the chart palettes here.

To disable the palette on your series call weekBarSeries.setCanApplyPalette(false). Then setLabelColor() and setFillColor() should work. Please note that after you disable the palette you will also have to provide the other visual settings like label size etc. because the palette will not set them.

Regards,
Victor
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Victor
Telerik team
answered on 18 May 2015, 11:33 AM
Another thing I forgot to mention. The key for the series labels is "SeriesLabels". To get the entries for the series labels you have to call 
palette.entriesForFamily("SeriesLabels");

Regards,
Victor
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Chart
Asked by
Richard
Top achievements
Rank 1
Answers by
Richard
Top achievements
Rank 1
Victor
Telerik team
Share this question
or