Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9065903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T16:37:15+00:00 2026-06-16T16:37:15+00:00

Within an Android app I am developing, I have a spinner where you can

  • 0

Within an Android app I am developing, I have a spinner where you can select different views of different data. Currently most of the graph types are Pie and this works ok. If I also switch from Pie to Line, that works. But if I switch from that Line chart back to a Pie chart, the chart displays ok, but the legend just displays ‘Series 0’. Switching back to the Line chart displays the Legend ok.

Here is how it looks:

the problem

This is the code which sets up the chart basics:

    //set up the TeeChart basics
LinearLayout group = (LinearLayout) view.findViewById(R.id.linearLayoutTchart);
chart = new TChart(PainRecordSummary_ViewPager.this);
group.addView(chart);
chart.getPanel().setTransparent(true);

//default 3D to true (will need to reset per chart)
chart.getAspect().setView3D(true);

This is the code which deals with switching the chart types:

    switch (graphType) {
case 0: // Location PIE CHART
if(PLS.getLocation() != null){
Pie pieLocation = new Pie(chart.getChart());

chart.removeLegendResolver();
chart.removeAllSeries();
chart.getAspect().setView3D(true);
try {
series = Series.createNewSeries(chart.getChart(), Pie.class,  null);
                } catch (InstantiationException e1) {
                    // TODO Auto-generated catch block
                    e1.printStackTrace();
                } catch (IllegalAccessException e1) {
                    // TODO Auto-generated catch block
                    e1.printStackTrace();
                }

for(int i=0; i<PLS.getLocation().size(); i++){
    series.add(PLS.getLocation().get(i).getItemPercent(), PLS.getLocation().get(i).getLocation());
}
pieLocation.add(series);
ColorPalettes.applyPalette(chart.getChart(), Theme.ModernPalette);
chart.getLegend().setAlignment(LegendAlignment.BOTTOM);
chart.getHeader().setVisible(false);
chart.getPanel().setTransparent(true);
chart.getWalls().getBack().setVisible(true);
((com.steema.teechart.styles.Pie)chart.getSeries(0)).setCircled(true);
((com.steema.teechart.styles.Pie)chart.getSeries(0)).getMarks().setVisible(false);
((com.steema.teechart.styles.Pie)chart.getSeries(0)).setExplodeBiggest(12);
((com.steema.teechart.styles.Pie)chart.getSeries(0)).getPen().setVisible(false);
}else{
//show no data
}
break;
case 5: //this will display a TIME SERIES of Pain Locations AVG. SEVERITY
chart.removeAllSeries();
chart.getAspect().setView3D(false);
//X AXIS
//set the x-axis date display to e.g. '01-JAN'
chart.getAxes().getBottom().getLabels().setDateTimeFormat("dd-MMM");
//set the angle of the date display
chart.getAxes().getBottom().getLabels().setAngle(45);
//Y AXIS
//set up the y axis title
AxisTitle yTitle;
yTitle=chart.getAxes().getLeft().getTitle();
yTitle.setCaption("Severity");
//end title
//set y to increment by 1
//override the auto min/max and set to 0/10
chart.getAxes().getLeft().setIncrement(1.00);

for(int i=0; i<PLR.size(); i++){
    Series ln = new Line(chart.getChart());
    ln.setTitle(PLR.get(i).getName());
    SeriesPointer tmpPointer;
    tmpPointer = ((CustomPoint)ln).getPointer();
    tmpPointer.setInflateMargins(true);
    tmpPointer.setStyle(PointerStyle.CIRCLE);
    tmpPointer.setVisible(true);
    for(int j=0; j<PLR.get(i).getItems().size(); j++){
        DateTime dt = new DateTime(
   DateDiff.getYearFromString(PLR.get(i).getItems().get(j).getDateRecord()),
   DateDiff.getMonthFromString(PLR.get(i).getItems().get(j).getDateRecord()),
   DateDiff.getDayFromString(PLR.get(i).getItems().get(j).getDateRecord()));

   ln.add(dt, (double)PLR.get(i).getItems().get(j).getSeverity().intValue());
    }
    ((com.steema.teechart.styles.Line)chart.getSeries(i)).getLinePen().setWidth(2);
}

Anyone have any ideas why that Legend isn’t repopulating? I’ve tried a bunch of stuff to try to invalidate the Legend or clear it, to no avail.

Many thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T16:37:16+00:00Added an answer on June 16, 2026 at 4:37 pm

    Try forcing the LegendStyle to LegendStyle.SERIES when showing your Line series:

    tChart1.getLegend().setLegendStyle(LegendStyle.SERIES);
    

    And to LegendStyle.VALUES when showing your Pie series:

    tChart1.getLegend().setLegendStyle(LegendStyle.VALUES);
    

    Just answered the same in the Steema Support forums here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've created an online store within an android app in webview but have one
I have about 50 images with in a grid view within my Android app.
I'm developing an android mobile app which potentially have a lot of users (let's
I'm currently developing an Android app, which loads events from a server using JSON
I'm developing a native mobile app for Android and iOS using PhoneGap.I have a
I am trying to create an interactive visualization within an android app. The data
I am developing an app in Android using Fragments. I have this three tabs:
I have Phonegap's Facebook plugin working perfectly within my Android app. This plugin uses
I am currently developing an android program. After some searching i can't seem to
I am developing an app for android where I need some data from a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.