Looks like, with the DataView technique, it's still not possible to support
both M and K (detecting the appropriate one based on size of the number),
since the suffix has to be fixed for the entire column.
I suppose it's still possible to detect one or the other, depending on the
v-axis min/max, maybe that's good enough.
On Thursday, May 10, 2012 1:12:00 PM UTC-7, asgallant wrote:
>
> Yeah, that's what the Formatters do (at least, insofar as I can tell),
> only they modify the DataTable instead of creating a DataView.
>
> On Thursday, May 10, 2012 3:35:17 PM UTC-4, caustik wrote:
>>
>> oops, that's pretty much exactly what your solution does. derp :)
>>
>> On Thursday, May 10, 2012 12:30:13 PM UTC-7, caustik wrote:
>>>
>>> Thx, for the reply and workaround solution!
>>>
>>> It seems like a flexible extension for a future version would be the
>>> ability to set a formatting callback which passes as a parameter the value,
>>> and you return whatever display value you want. Maybe that already happens
>>> under the hood somewhere for the existing formatters, and would just need
>>> to have a hook exposed.
>>>
>>> function blah(val) { return (val / 1000000) + "M"; }
>>>
>>> vAxis: {
>>> format: 'custom("blah")'
>>> }
>>>
>>> On Thursday, May 10, 2012 12:21:23 PM UTC-7, asgallant wrote:
>>>>
>>>> Unfortunately, the only formatting you can do with the axis is via the
>>>> vAxis.format option, which takes a string that is a pattern from a subset
>>>> of the ICU Pattern
>>>> Set<http://icu-project.org/apiref/icu4c/classDecimalFormat.html#_details>.
>>>> You can transform your data manually, however, to get the units to the
>>>> correct size, and then append the unit to the axis and tooltip values.
>>>> See: http://jsfiddle.net/asgallant/6kyhf/
>>>>
>>>> On Thursday, May 10, 2012 1:57:59 PM UTC-4, caustik wrote:
>>>>>
>>>>> I can't for the life of me seem to find a way to transform the values
>>>>> of vertical axis labels.
>>>>>
>>>>> There are formatters like "google.visualization.NumberFormat" - but it
>>>>> doesn't seem to support custom algorithms for transforming numbers. Is
>>>>> there any way to enumerate and manually transform labels?
>>>>>
>>>>> Here's a mock-up of what I'm shooting for:
>>>>> http://i.imgur.com/XLEno.png
>>>>>
>>>>
--
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/-/TGi3tNun5owJ.
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.