Thank you so much for posting a possible solution with all the details.
But I am looking for a different and simple solution where I do not want to
convert data with in Google charts. I have all the data (for chart drawing,
display) out there which I need to pass in to the Google charts. I need to
pass in two values, one value for chart drawing and the second correspoding
text for displaying it along X or Y axis. I thought this is very basic
feature will should have been there in Google charts. I do not want to
convert/format data with in Google charts as that is my core business logic
which I want to keep it separately. I if I can do that, that will save my
day.
Best Regards
Nvas
On Tuesday, July 24, 2012 8:56:20 AM UTC-7, asgallant wrote:
>
> The y-axis is easy, just set the vAxis.format option to '# Pounds'.
> Getting the x-axis formatted correctly depends on how your data is
> structured. If you need a continuous axis, then you will have to put your
> data in a Date object. If you can get by with a discrete axis, then you
> can put the data in string format. Either way, you will need to use a
> DataView with a calculated column for the date. To get the data in Date
> object form, use this:
>
> var view = new google.visualization.DataView(data);
>
> var baseDate = /*date to start from, in ms from the Unix Epoch (Jan 1,
> 1970 00:00:00:000 GMT)*/;
> view.setColumns([{
> type: 'date',
> label: 'Date',
> calc: function (dt, row) {
> // get ms from minutes
> var ms = dt.getValue(row, 0) * 60000;
> return new Date(baseDate + ms);
> }
> }, 1]);
>
> to get it in string format use this:
>
> var view = new google.visualization.DataView(data);
>
> // assumes the DataTable contains the formatted date value
> view.setColumns([{
> type: 'string',
> label: 'Date',
> calc: function (dt, row) {
> return dt.getFormattedValue(row, 0);
> }
> }, 1]);
>
> Then you draw the chart using the view instead of the dataTable:
>
> chart.draw(view, {/*options*/});
>
> On Tuesday, July 24, 2012 2:53:35 AM UTC-4, Seddi1 wrote:
>>
>> I need to display the formatted value along the X and Y axis of the
>> chart. The trick is I need to use the value (not the formatted one) for all
>> calculation purposes of the chart, but I don't want to display this value
>> along X and Y axis, instead I want display the formatted value along X and
>> Y axis. Right now the formatted value is displayed on mouse over the chart,
>> and I also want this formatted value to be displayed along X and Y axis.
>>
>> For example:
>>
>> Date - (X Axis)
>>
>> Jan 1 2000 (Formated Value), 2,220,0000 (Value in minutes
>> corresponding to this date which should be used for graph calculation but
>> not display)
>> Jan 1 2005 (Formatted Value), 2,720,0000 (Value in minutes
>> corresponding to this date which should be used for graph calculation but
>> not display)
>> Jan 1 2010 (Formatted Value), 3,120,0000 (Value in minutes
>> corresponding to this date which should be used for graph calculation but
>> not display)
>>
>> Weight (Y Axis)
>>
>> 100 Pounds (Formatted Value), 100 (Value which should be used for
>> graph calculation but not display)
>> 140 Pounds (Formatted Value), 140 (Value which should be used for
>> graph calculation but not display)
>> 160 Pounds (Formatted Value), 160 (Value which should be used for
>> graph calculation but not display)
>>
>> Current/default behavior that I am seeing when the chart is drawn:
>>
>> 160 |
>> 140 |
>> 100 |
>> ----------------------------------------------------------------
>> 2,220,0000 2,720,0000 3,120,0000
>>
>> Behavior that I am looking to achieve
>>
>> 160 Pounds |
>> 140 Pounds |
>> 100 Pounds |
>>
>> ----------------------------------------------------------------
>> Jan 1 2000 Jan 1 2005 Jan 1 2010
>>
>> I highly appreciate your help here.
>>
>> Thanks
>> Nvas
>>
>>
>>
>>
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-visualization-api/-/Fhq39gMXEhIJ.
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.