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! To enable all features please Login or Register.

Notification

Icon
Error

Options
View
Go to last post Go to first unread
s_pai  
#1 Posted : Monday, February 21, 2011 11:41:31 PM(UTC)
s_pai
Rank: Newbie

Groups: Registered
Joined: 2/21/2011(UTC)
Posts: 3

Hello,

We're evaluating aiCharts and I hit a roadblock. We need to create charts dynamically at runtime, from XML. I can't seem to find any good examples of this, are there any?

The following is what I'm trying right now and it doesn't display a chart, only the trial license message.

onCreate contains:
Code:
ChartView chartView = new ChartView(this);

XmlPullParser parser;
try {
    XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
    factory.setNamespaceAware(true);
    parser = factory.newPullParser();
    parser.setInput(new InputStreamReader(getAssets().open("chart.xml")));
} catch (XmlPullParserException e) {
    Log.e(TAG, "Failed to get XmlPullParserFactory", e.getCause());
    return;
} catch (IOException e) {
    Log.e(TAG, "Failed to open data.xml", e.getCause());
    return;
}
        
ChartEngine chart = new ChartEngine(getResources(), parser);
chartView.setChart(chart);

LinearLayout layout = new LinearLayout(this);
layout.addView(chartView);
setContentView(layout);


chart.xml contains:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<chart>
    <title text="Chart XML Sample"/>
    <area/>
    <series type="Column" showlabel="true" points="20, 10, 40, 30, 50"/>
    <legend dock="Right"/>
</chart>


Am I using ChartEngine incorrectly? Missing something else obvious? Any pointers are greatly appreciated, thanks!

Sami

edit: I logged chartView.getAreas() before and after calling setChart(), and it remains empty. Perhaps I should set the XML parser to a specific state before passing it to ChartEngine.

Edited by user Tuesday, February 22, 2011 8:57:40 PM(UTC)  | Reason: Not specified

Baydalka Volodymyr  
#2 Posted : Tuesday, February 22, 2011 6:20:29 PM(UTC)
Baydalka Volodymyr
Rank: Member

Groups: Registered
Joined: 7/28/2009(UTC)
Posts: 447
Man

Hi,

Thank you for bug report. The problem is that XML contains inner text (space/tab chars). Android APK builder usually compresses XML resources (aiCharts usually works with XML from resources) and removes empty text. Try to remove spaces and tabs from your XML for now.

Best regards,
Volodymyr Baydalka
Andriod development and support team
s_pai  
#3 Posted : Tuesday, February 22, 2011 8:57:27 PM(UTC)
s_pai
Rank: Newbie

Groups: Registered
Joined: 2/21/2011(UTC)
Posts: 3

Removing the extra whitespace works. Thanks!
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-2017 ArtfulBits. All rights reserved.