I still have problem with NumberFormat in Annotated time line. Here
is the code in GWT that is ignored by the api:
com.google.gwt.visualization.client.formatters.NumberFormat.Options
nOptions =
com.google.gwt.visualization.client.formatters.NumberFormat.Options.create();
nOptions.setPrefix("$");
NumberFormat formatter = NumberFormat.create(nOptions);
DataTable data = getCompanyPerformance();
formatter.format(data, 1);
formatter.format(data, 2);
Options options = Options.create();
AnnotatedTimeLine viz = new AnnotatedTimeLine(data, options,"700px",
"240px");
I know that the API is working on JS, but maybe not on GWT wrapper of
JS. Any idea?
On Jan 4, 4:28 am, Viz Kid <[email protected]> wrote:
> Hi.
>
> Annotated time line currently ignores the formatted values of the data table
> as it has a parameter for formatting the numbers of each series named
> numberFormats
> (seehttp://code.google.com/apis/visualization/documentation/gallery/annot...
> more details).
>
> The API indeed separates the displayed values from the actual values by
> allowing the user to specify the formatted value for each cell. The
> predefined formatters cannot cover all possible formatting formats that
> users would need. A simple solution would be to implement your own formatter
> which simply goes over the column of numbers and set their formatted value
> to be of the format you prefer.
>
> Hope this helps,
> Viz Kid
>
> On Fri, Jan 1, 2010 at 11:15 PM, Budband <[email protected]> wrote:
> > I think the api should provide an option to separate the display value
> > from the actual value, or at least it should be easy to do so by
> > hacking the javascript code, something that I am not interested in :)
>
> > I am leaning towards a solution to provide a field to DataTable as
> > 'DisplayValue' or applying a formula to NumberFormat, so It can be
> > dynamic representation of the Actual Value.
>
> > On Jan 1, 8:12 am, c2billp <[email protected]> wrote:
> > > This is an issue that I'm struggling with as well. If you choose data
> > > type "timeofday" then sorting and display in datatables works ok but
> > > you can not chart values of that datatype
>
> > > my solution has been to add a col to the datatable that holds the
> > > second value and use that for charting while the timeofday col I use
> > > for display.
>
> > > I think (but have not tested yet) that another solution would be to
> > > produce the following (from server side)
>
> > > data.setCell(0,3,88.22,'1:22:34'',{'style': 'border: 3px solid
> > > deeppink)
>
> > > This will I hope result is the user seeing the 1:22:34 value in
> > > tooltip and yet having the chart plot the numerical value 88.22
>
> > > bill
> > > On Jan 1, 4:45 am, Budband <[email protected]> wrote:
>
> > > > Is it possible to format the number(which is a time) from decimal to
> > > > minute:seconds.milliseconds and display it on the Chart ?
> > > > For example if the number is 88.22 seconds (1 min and 22.22 seconds)
> > > > the number should be displayed as 1:22.22 in the chart (tooltip).
>
> > > > I was almost able to do that in the LineChart using the following:
>
> > > > com.google.gwt.visualization.client.formatters.NumberFormat.Options
> > > > nOptions =
>
> > com.google.gwt.visualization.client.formatters.NumberFormat.Options.create
> > > > ();
> > > > nOptions.setFractionDigits(2);
> > > > nOptions.setDecimalSymbol(":");
> > > > nOptions.setPrefix("New Formatted Time is -> ");
> > > > nOptions.setSuffix(".22");
> > > > NumberFormat formatter = NumberFormat.create(nOptions);
>
> > > > // Drop the decimal part from the number when populating the DataTable
> > > > DataTable data = getCompanyPerformance();
> > > > formatter.format(data, 1);
>
> > > > Well, there are 2 problems with this approach.
> > > > 1 - The Suffix can not be dynamic, i.e. couldn't find a way to pass a
> > > > parameter to the setSuffix method, neither was able to apply the
> > > > formatter with different Suffix to each number.
> > > > 2 - The NumberFormat won't work on the datatable used for
> > > > AnnotatedTimeLine !!
>
> > > > I also checked the PatternFormat with no success.
>
> > > > Thanks for your help.- Hide quoted text -
>
> > > - Show quoted text -
>
> > --
>
> > You received this message because you are subscribed to the Google Groups
> > "Google Visualization API" group.
> > To post to this group, send email to
> > [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<google-visualization-api%[email protected]>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-visualization-api?hl=en.
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-visualization-api?hl=en.