What order to set data/series/label design

5 posts, 0 answers
  1. Richard
    Richard avatar
    44 posts
    Member since:
    Jun 2014

    Posted 15 May 2015 Link to this post

    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

     

     

     

  2. Richard
    Richard avatar
    44 posts
    Member since:
    Jun 2014

    Posted 15 May 2015 in reply to Richard Link to this post

    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

  3. DevCraft banner
  4. Richard
    Richard avatar
    44 posts
    Member since:
    Jun 2014

    Posted 15 May 2015 in reply to Richard Link to this post

    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

     

  5. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 18 May 2015 Link to this post

    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
  6. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 18 May 2015 Link to this post

    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
Back to Top
DevCraft banner