Timeline Graph X-axis values

29 views
Skip to first unread message

sdev

unread,
Apr 26, 2010, 12:13:19 AM4/26/10
to ChartDroid Users
Hi,

I would like to display timeline data on the events graph but I
followed the demo program and the x-axis labels are all in
percentages... may I know how do I edit the axis labels? I only
require numbers on my axis not market percentages..

Thank you!


--
Subscription settings: http://groups.google.com/group/chartdroid-users/subscribe?hl=en

Karl Ostmo

unread,
Apr 26, 2010, 1:07:44 AM4/26/10
to chartdro...@googlegroups.com
I would like to display timeline data on the events graph but I
followed the demo program and the x-axis labels are all in
percentages... may I know how do I edit the axis labels? I only
require numbers on my axis not market percentages..

Set the format string by passing the "com.googlecode.chartdroid.intent.extra.FORMAT_STRING_X" Intent extra.  Here is the documentation for that part: http://code.google.com/p/chartdroid/wiki/InterfaceSpecification#Intent_Extras

Karl

sdev

unread,
Apr 26, 2010, 1:34:08 AM4/26/10
to ChartDroid Users
mm.. thanks! i saw that but i did not understand what formats to
use... I will check the string patterns syntax..

btw, for series colours what is the format of the int[]? I tried

i.putExtra(ChartSchema.EXTRA_SERIES_COLOURS, new int[] {255,250,250});

but it did not work...
> is the documentation for that part:http://code.google.com/p/chartdroid/wiki/InterfaceSpecification#Inten...
>
> Karl

sdev

unread,
Apr 26, 2010, 1:51:24 AM4/26/10
to ChartDroid Users
I tried this:
Intent i = new Intent(Intent.ACTION_VIEW, ChartProvider.BASE_URI);

i.putExtra("com.googlecode.chartdroid.intent.extra.FORMAT_STRING_Y", "$
%.2f");
startActivity(i);

but it did not work as well... am i doing something wrong? the
base_uri is without any parameters in data just content://com.mydomain/events
and i am using the events data plot

Karl Ostmo

unread,
Apr 27, 2010, 1:01:52 AM4/27/10
to chartdro...@googlegroups.com
btw, for series colours what is the format of the int[]? I tried

i.putExtra(ChartSchema.EXTRA_SERIES_COLOURS, new int[] {255,250,250});

but it did not work...

This was an unimplemented feature, but I have just added it and uploaded a new version to the Market.  It should work now, but make sure that your colors are 32-bit integers.  See http://developer.android.com/reference/android/graphics/Color.html



I tried this:
Intent i = new Intent(Intent.ACTION_VIEW, ChartProvider.BASE_URI);

i.putExtra("com.googlecode.chartdroid.intent.extra.FORMAT_STRING_Y", "$
%.2f");
               startActivity(i);

but it did not work as well... am i doing something wrong?

There is a working example of what you want in this file:
http://code.google.com/p/chartdroid/source/browse/trunk/market_sales/src/com/googlecode/chartdroid/market/sales/task/SpreadsheetFetcherTask.java#141

If you run the Market Sales Plotter app you will see that it formats the y-axis labels with a dollar sign.  In your case, is it still formatting the labels with a percent sign, or is the chart failing to launch altogether?

Karl

sdev

unread,
Apr 27, 2010, 2:05:02 AM4/27/10
to ChartDroid Users
I did follow the spreadsheetfetchertask but it still shows the
percentages that was why I wonder if its a bug since I am sending the
intent through another app..

When I add the intent extra for Intent.ExtraTitle or the axes labels
it works so I went to see the source for the timechartactivity...
it seems that the intentextra for the format string is returning null
and I read that if the pendingintent was used, it must use the
oncompletelistener before the intent extras can reach the activity and
not produce a null value...


On Apr 27, 1:01 pm, Karl Ostmo <kos...@gmail.com> wrote:
> > btw, for series colours what is the format of the int[]? I tried
>
> > i.putExtra(ChartSchema.EXTRA_SERIES_COLOURS, new int[] {255,250,250});
>
> > but it did not work...
>
> This was an unimplemented feature, but I have just added it and uploaded a
> new version to the Market.  It should work now, but make sure that your
> colors are 32-bit integers.  Seehttp://developer.android.com/reference/android/graphics/Color.html
>
> I tried this:
>
> > Intent i = new Intent(Intent.ACTION_VIEW, ChartProvider.BASE_URI);
>
> > i.putExtra("com.googlecode.chartdroid.intent.extra.FORMAT_STRING_Y", "$
> > %.2f");
> >                startActivity(i);
>
> > but it did not work as well... am i doing something wrong?
>
> There is a working example of what you want in this file:http://code.google.com/p/chartdroid/source/browse/trunk/market_sales/...
>
> If you run the Market Sales Plotter app you will see that it formats the
> y-axis labels with a dollar sign.  In your case, is it still formatting the
> labels with a percent sign, or is the chart failing to launch altogether?
>
> Karl
>

Karl Ostmo

unread,
Apr 27, 2010, 3:16:10 PM4/27/10
to chartdro...@googlegroups.com
On Tue, Apr 27, 2010 at 1:05 AM, sdev <yeost...@nus.edu.sg> wrote:
I did follow the spreadsheetfetchertask but it still shows the
percentages that was why I wonder if its a bug since I am sending the
intent through another app..

Are you using a PendingIntent rather than a standard Intent to launch ChartDroid?  I haven't tried this.  Can you post the code you're using to do this?

When I add the intent extra for Intent.ExtraTitle or the axes labels
it works so I went to see the source for the timechartactivity...

Are you saying that the format label works when these other Intent extras are present?  Or does the format label not work, but the title and axis labels do?

it seems that the intentextra for the format string is returning null

Did you test this by inserting Log statements in the ChartDroid source code? Or are you talking about inside your own application still?
 
I read that if the pendingintent was used, it must use the
oncompletelistener before the intent extras can reach the activity and
not produce a null value...

Interesting, can you point me toward the documentation that says this?

Karl

sdev

unread,
Apr 28, 2010, 2:49:50 PM4/28/10
to ChartDroid Users

> Are you using a PendingIntent rather than a standard Intent to launch
> ChartDroid?  I haven't tried this.  Can you post the code you're using to do
> this?

I am using the normal intent code as mentioned previously but I
started the activity directly without passing through a similar
Market.java check

> Are you saying that the format label works when these other Intent extras
> are present?  Or does the format label not work, but the title and axis
> labels do?

Oh I meant only the title and axis labels work...

> Did you test this by inserting Log statements in the ChartDroid source code?
> Or are you talking about inside your own application still?

I was only testing within my app as I did not have time to directly
test with the source...

>
> > I read that if the pendingintent was used, it must use the
> > oncompletelistener before the intent extras can reach the activity and
> > not produce a null value...
>
> Interesting, can you point me toward the documentation that says this?

Actually it isn't in a documentation, I just read it from a group
discussion, Mark Murphy replied regarding null extras...
http://groups.google.com/group/android-developers/browse_thread/thread/f23bba978ef5ade5/c38823ffe5e41e1c?show_docid=c38823ffe5e41e1c

Karl Ostmo

unread,
Apr 30, 2010, 2:00:19 AM4/30/10
to chartdro...@googlegroups.com
If you are checking the format string intent extra from within your own application and you find the value to be null, then ChartDroid will definitely definitely not receive the format string that you intended.

Karl

sdev

unread,
Apr 30, 2010, 5:54:40 AM4/30/10
to ChartDroid Users
Hi, that was not what I meant... I can see the extra in my own app
using getstringextra... I am saying that ChartDroid is not receiving
my intent extra at all and I do not know why...
> >http://groups.google.com/group/android-developers/browse_thread/threa...- Hide quoted text -
>
> - Show quoted text -

Karl Ostmo

unread,
Apr 30, 2010, 6:28:14 AM4/30/10
to chartdro...@googlegroups.com
My recommendation would be to start with the source code of either the "client" project or "market_sales" project (inside /trunk/) and verify that the y-axis format is being set, then tweak the relevant code of one of those projects incrementally until it looks like the code in your own project.  Step by step, re-run it and see which change causes the format string to fail.

If you compile and run the "client" (ChartDroid Demo) project and click the "Sample Datasets" button, then the "Multi-Timeline" button, you'll see another example of the y-axis labels being changed.  The line in the source code where this is set is here:
http://code.google.com/p/chartdroid/source/browse/trunk/client/src/com/googlecode/chartdroid/demo/SampleDatasetsActivity.java#98

Karl

Karl Ostmo

unread,
May 2, 2010, 7:16:56 PM5/2/10
to chartdro...@googlegroups.com
You might want to uninstall ChartDroid then re-install it from the market.  For some reason, just updating it didn't work, and I, too, saw percentages instead of dollar signs.

Karl
Reply all
Reply to author
Forward
0 new messages