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

Aligning the PieChart and receiving the color of slice Options · View
mdhari
#1 Posted : Thursday, January 13, 2011 2:46:09 AM
Rank: Newbie

Groups: Registered

Joined: 1/13/2011
Posts: 7
Location: Bay Area
Hi,

So I'm trying to dive into the software but I still could use some guidance. Basically I have a PieChart that rotates thanks to Volodymyr Baydalka.

I want to implement this feature where when I hit a particular slice on the chart, the whole PieChart rotates with that slice stopping dead center of the slice at the bottom of the screen.

I have series.getAttribute(ChartPieType.ANGLE_OFFSET); to work with, but I don't quite get what this means with the documentation saying "Identifies the angle offset of pie slices." Does that mean that every slice on the chart is independent somehow? Or is there a permanent reference that it's making on the chart as a whole?

Also, is there a way to get the color that the PieChart used for that particular slice. I see that ChartArea has a ChartPallete hidden deep within ChartEngine through debugging, but I can't access it.

You can see I'm already complicating things. Any help/clarification would be greatly appreciated.
Baydalka Volodymyr
#2 Posted : Thursday, January 13, 2011 3:20:32 PM
Rank: Developers Team


Groups: Registered, Administrators

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

Yes, every slice of the pie is somehow independent (color, label, etc.), but ChartPieType.ANGLE_OFFSET attribute affects for whole pie chart (pie chart series).

In order to get/set instance of ChartPallete use following methods - ChartView.getPalette()/setPalette()

Best regards,
Volodymyr Baydalka
Andriod development and support team
mdhari
#3 Posted : Friday, January 14, 2011 1:37:37 AM
Rank: Newbie

Groups: Registered

Joined: 1/13/2011
Posts: 7
Location: Bay Area
Hi again,

Thanks for the response. So now I have a two part question:

All I really want is to find the center point of the edge of the slice and then rotate from there to the bottom of the actual pie chart area to get the desired result of scrolling that slice to the bottom.

I'm trying to extract some information from the slice that's clicked using HitTest, but I seem to have trouble extracting what I need from the ChartArea and ChartPoint that's returned. I noticed that there is a Rect graphic being redrawn over and over with the bounds function. Could you suggest an easier way to extract useful information about a slice.

My other question regards Line charts and shading. I noticed in other posts about using a gradient.xml which is fine. But I really want to the following:

A line that is white, a blue shading lightly underneath, pure black shading when reaching the bottom.

I had to convert my ChartType to Area from Line but now my StripLines for ranges is getting hidden behind the colors and my white line is gone.

Attached is a pic of what I'm really trying to accomplish and the snippet of code that I'm using.

Quote:
final ChartView chartView = new ChartView(this);
final ChartAxisStripLine rangeStripLine = new ChartAxisStripLine(0, 0);
final ChartArea chartArea = new ChartArea();
final ChartSeries series = new ChartSeries(ChartTypes.Line);

series.getPoints().setData(values);

chartArea.getDefaultXAxis().getStripLines().add(rangeStripLine);
chartArea.getDefaultXAxis().setGridVisible(false);

chartArea.getDefaultYAxis().setGridVisible(false);

series.setBackColor(Color.WHITE);
series.setBackDrawable(getResources().getDrawable(R.drawable.gradient));
series.setBackFilterEnabled(Boolean.TRUE);
//series.setBorderColor(Color.WHITE);
chartView.getSeries().add(series);
chartView.getAreas().add(chartArea);
//chartView.setPalette(new ChartPalette(Color.WHITE));
mdhari attached the following image(s):
Screen shot 2011-01-13 at 3.32.58 PM.png (12kb) downloaded 42 time(s).
Baydalka Volodymyr
#4 Posted : Friday, January 14, 2011 2:39:39 PM
Rank: Developers Team


Groups: Registered, Administrators

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

1) You can't extract this information from aiCharts, because aiCharts doesn't store it. But you may to compute it manually. Please check updated sample

2) StripLines cannot be displayed over chart. You should use custom drawing to display selected range. Please check updated sample

Best regards,
File Attachment(s):
aiChartsSample45.zip (18kb) downloaded 5 time(s).
Volodymyr Baydalka
Andriod development and support team
mdhari
#5 Posted : Friday, January 14, 2011 8:46:43 PM
Rank: Newbie

Groups: Registered

Joined: 1/13/2011
Posts: 7
Location: Bay Area
Hi,

Thank you so much for this. The LineActivity is really impressive.

~Michael
Users browsing this topic
Guest (2)
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.