whitespace COMPANY whitespace SERVICES whitespace PRODUCTS whitespace PURCHASE whitespace SUPPORT whitespace CONTACTS whitespace Home whitespace Contact Us whitespace Site Map whitespace
whitespace
SUPPORT
whitespace
FORUM
whitespace
FAQS
whitespace
SUBSCRIPTION
whitespace
REQUEST ON-LINE
whitespace
whitespace

Technical Support Forum

Welcome Guest Search | Active Topics | Log In | Register

Multiple AreaChart doesn't work Options · View
frenz
#1 Posted : Friday, January 21, 2011 5:29:40 PM
Rank: Newbie

Groups: Registered

Joined: 12/9/2010
Posts: 7
Location: Italy
Hello!
in my application I need to have two charts one above the other. i write the code as indicated in the application examples, but when i run it in the chartview i find just the last and instead of the first i have white space. see the attached picture.
how can i resolve?
thanks a lot,

Francesco
frenz attached the following image(s):
screenshot.jpg (17kb) downloaded 56 time(s).
alexk
#2 Posted : Friday, January 21, 2011 5:36:56 PM
Rank: Administration


Groups: Registered

Joined: 7/28/2009
Posts: 55
Location: Ukraine, Lviv
1) check own layouts
2) check that you create several chart areas
2) try to use samples layouts and configurations
ArtfulBits Team
Product Director
Baydalka Volodymyr
#3 Posted : Monday, January 24, 2011 12:03:35 PM
Rank: Developers Team


Groups: Registered, Administrators

Joined: 7/28/2009
Posts: 447
Hi,

Do you use one ChartView with two ChartAreas? If so, make sure that you set correct area-name for each series.

Best regards,
Volodymyr Baydalka
Andriod development and support team
frenz
#4 Posted : Wednesday, January 26, 2011 10:05:12 AM
Rank: Newbie

Groups: Registered

Joined: 12/9/2010
Posts: 7
Location: Italy
Hi,
I start from the example provided on the web site, but the result is the one shown before. Further, i forget to say that if I invert the two areas, the charts shown is always the second, while the first is hide.
Baydalka Volodymyr
#5 Posted : Wednesday, January 26, 2011 1:02:52 PM
Rank: Developers Team


Groups: Registered, Administrators

Joined: 7/28/2009
Posts: 447
Hi,

Pelase check MultipleAreas sample from aiChart package - (aiCharts package\Samples\MultipleAreas)

Best regards,
Volodymyr Baydalka
Andriod development and support team
frenz
#6 Posted : Wednesday, January 26, 2011 3:54:24 PM
Rank: Newbie

Groups: Registered

Joined: 12/9/2010
Posts: 7
Location: Italy
I've already check the sample...but the problem persists..i attach some code, whose result is a chart view where just areaPesi is shown:




final ChartArea areaPesi = chartGenerator.getPesoAreaChart();
final ChartArea areaSintomo = chartGenerator.getSintomiArea();

double pesoMassimo = db.getPesoMax();
double pesoMinimo = db.getPesoMin();

//setta l'aerea per le diverse serie

areaPesi.setBackground(getResources().getDrawable(R.color.background_dashboard_selected));
areaSintomo.setBackground(getResources().getDrawable(R.color.background_dashboard_selected));

chartView.getAreas().add(areaPesi);
chartView.getAreas().add(areaSintomo);

ChartAxis xAx = chartView.getAreas().get(0).getDefaultXAxis();
//mette la data sull'asse x
xAx.setFormat(sdf);
xAx.getScale().setZoomPosition(xAx.getScale().getRealMaximum());

ChartAxis yAx = areaPesi.getDefaultYAxis();
yAx.setTitle("Kg");
yAx.getScale().setMinimum(pesoMinimo-0.5);
yAx.getScale().setMaximum(pesoMassimo+0.5);



seriePesi.setArea(areaPesi.getName());




ChartSeries s1 = new ChartSeries("s1",ChartTypes.Line);
for(ChartPoint cp:seriePesi.getPoints()){
s1.getPoints().add(cp);
}
s1.setArea(areaSintomo.getName());


//Colore giallo della linea dei pesi:
seriePesi.setBackColor(getResources().getColor(R.color.yellow));
seriePesi.setLineWidth(5);

//serie fantasma che serve per evitare un bug della legenda
// adding a dummy series
ChartSeries dummy = new ChartSeries(" ", ChartTypes.CandleStick);
dummy.setBackColor(Color.TRANSPARENT);


ChartLegend legend = new ChartLegend();
chartView.getLegends().add(legend);

//imposta lo scorrimento orizzontale
chartView.getChart().setAutoAlignAreas(true);
chartView.setPanning(ChartView.PANNING_HORIZONTAL);

chartView.getSeries().add(s1);
chartView.getSeries().add(dummy);
chartView.getSeries().add(seriePesi);
Baydalka Volodymyr
#7 Posted : Wednesday, January 26, 2011 5:14:13 PM
Rank: Developers Team


Groups: Registered, Administrators

Joined: 7/28/2009
Posts: 447
Hi,

Please check following information
Quote:
aiCharts elements naming rules.

1) Each of aiCharts elements should have a name. Use ChartSeries/ChartArea/ChartLegend.setName method to set one.

2) Name should be unique; otherwise an exception will be thrown when you will add it.

3) By default name is empty. If the element name isn’t set, ChartEngine generate the default name (“series_2”, “area_1”, “series_3” etc.)

4) To bind the series to the specified area/legend use ChartSeroies.setArea/setLegend method and specify the name of the area/legend. By default these values are empty and series use first area/legend on the chart. (NOTE: if you change first area/legend, it will affect to series too)


Please make sure that corresponding names is correct, cause I can't see code that set the area name for all series. Try to use predefined area names.

Best regards,
Volodymyr Baydalka
Andriod development and support team
frenz
#8 Posted : Wednesday, January 26, 2011 6:13:59 PM
Rank: Newbie

Groups: Registered

Joined: 12/9/2010
Posts: 7
Location: Italy
This is how I create the ChartAreas:


ChartArea areaFarmaci = new ChartArea("FarmaciArea");
AreaFarmaci.setBackground(mContext.getResources().getDrawable(R.color.background_dashboard_selected));



//Crea e aggiunge l'area dei farmaci

ChartAxis xAxFarmaco = areaFarmaci.getDefaultXAxis();
xAxFarmaco.setFormat(sdf);

ChartAxis yAxFarmaco = areaFarmaci.getDefaultYAxis();
//yAxFarmaco.getScale().mulZoom(1.5);
yAxFarmaco.setTitle("Farmaci");
Baydalka Volodymyr
#9 Posted : Friday, January 28, 2011 4:57:10 PM
Rank: Developers Team


Groups: Registered, Administrators

Joined: 7/28/2009
Posts: 447
Hi,

Unfortunately we can't reproduce this bug. As I understand you you one ChartView this two ChartArea and three ChartSeries. You try to bind one series to second area. Try to use constant values to bind this series. Example :
Code:

static final String FIRST_AREA_NAME = "first";
static final String SECOND_AREA_NAME = "second";
...

ChartArea area1 = new ChartArea(FIRST_AREA_NAME);
ChartArea area2 = new ChartArea(SECOND_AREA_NAME);

ChartSeries series0 = new ChartSeries();
ChartSeries series1 = new ChartSeries();
ChartSeries series2 = new ChartSeries();

series1.setArea(FIRST_AREA_NAME); // attach to first area
series2.setArea(SECOND_AREA_NAME); // attach to seconds area

chartView.getSeries().add(series0);
chartView.getSeries().add(series1);
chartView.getSeries().add(series2);

//it's default area (first area in the collection).
//series0 will use it, because we do not specify area name
chartView.getAreas().add(area1);
chartView.getAreas().add(area2);


Also, I found something weird in your code. Do not use one ChartPoint instance for several series.
Code:
for(ChartPoint cp:seriePesi.getPoints()){
s1.getPoints().add(cp);
}


Best regards,
Volodymyr Baydalka
Andriod development and support team
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Company | Services | Practices | Technologies | Career | Contacts | Privacy
© 2005-2016 ArtfulBits. All rights reserved.