JavaScript Literal Notation pattern property not applying format to column data

15 views
Skip to first unread message

Jeremiah

unread,
May 2, 2016, 5:55:05 PM5/2/16
to Google Visualization API
Using the current version of the API the pattern column is not being applied to the data in the column. The goal is for numbers to appear without the comma.  I know that I can use NumberFormat but don't want to since this would require... re-coding (work)!!

  var data1 = google.visualization.arrayToDataTable
            ([['Price', 'Profit/Lost', {'type': 'string', 'role': 'style','pattern':'####'}],
              [1.9 , 10000, null],
              [2 , 5000, null],
              [2.1, 0, 'point {shape-type: triangle;  shape-rotation: 180;}']
        ]);


Using version 42 the patter is recognized and the data is formatted properly without the commas.


Daniel LaLiberte

unread,
May 2, 2016, 8:37:26 PM5/2/16
to Google Visualization API
Version 42 is not actually using the pattern.  What it is doing is just using the default toString() on the number, which was worse.  For now, you'll have to use NumberFormat to generate all the formatted representations yourself, but something like the pattern you specified would be a good idea.

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/38f3da28-9e17-415f-a247-e3efab931528%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Jeremiah

unread,
May 3, 2016, 8:34:57 AM5/3/16
to Google Visualization API
In the example provided here how would I use the pattern property to format using an ICU pattern set? 


On Monday, May 2, 2016 at 8:37:26 PM UTC-4, Daniel LaLiberte wrote:
Version 42 is not actually using the pattern.  What it is doing is just using the default toString() on the number, which was worse.  For now, you'll have to use NumberFormat to generate all the formatted representations yourself, but something like the pattern you specified would be a good idea.
On Mon, May 2, 2016 at 5:55 PM, Jeremiah <clin...@gmail.com> wrote:
Using the current version of the API the pattern column is not being applied to the data in the column. The goal is for numbers to appear without the comma.  I know that I can use NumberFormat but don't want to since this would require... re-coding (work)!!

  var data1 = google.visualization.arrayToDataTable
            ([['Price', 'Profit/Lost', {'type': 'string', 'role': 'style','pattern':'####'}],
              [1.9 , 10000, null],
              [2 , 5000, null],
              [2.1, 0, 'point {shape-type: triangle;  shape-rotation: 180;}']
        ]);


Using version 42 the patter is recognized and the data is formatted properly without the commas.


--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+unsub...@googlegroups.com.



--

Daniel LaLiberte

unread,
May 3, 2016, 10:31:01 AM5/3/16
to Google Visualization API
Hi Jeremiah,

I'm saying you can't use the pattern property now, but it would be a good idea if we could support it.  In fact, if you use charts via a spreadsheet, there is a pattern property that is passed through and used in that situation only.   We'll look into generalizing this feature in the future.

On Tue, May 3, 2016 at 8:34 AM, Jeremiah <clin...@gmail.com> wrote:
In the example provided here how would I use the pattern property to format using an ICU pattern set? 
https://developers.google.com/chart/interactive/docs/roles#javascript-literal-notation

On Monday, May 2, 2016 at 8:37:26 PM UTC-4, Daniel LaLiberte wrote:
Version 42 is not actually using the pattern.  What it is doing is just using the default toString() on the number, which was worse.  For now, you'll have to use NumberFormat to generate all the formatted representations yourself, but something like the pattern you specified would be a good idea.
On Mon, May 2, 2016 at 5:55 PM, Jeremiah <clin...@gmail.com> wrote:
Using the current version of the API the pattern column is not being applied to the data in the column. The goal is for numbers to appear without the comma.  I know that I can use NumberFormat but don't want to since this would require... re-coding (work)!!

  var data1 = google.visualization.arrayToDataTable
            ([['Price', 'Profit/Lost', {'type': 'string', 'role': 'style','pattern':'####'}],
              [1.9 , 10000, null],
              [2 , 5000, null],
              [2.1, 0, 'point {shape-type: triangle;  shape-rotation: 180;}']
        ]);


Using version 42 the patter is recognized and the data is formatted properly without the commas.


--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualizati...@googlegroups.com.



--

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualizati...@googlegroups.com.

To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.

For more options, visit https://groups.google.com/d/optout.



--

Jeremiah

unread,
May 3, 2016, 11:04:41 AM5/3/16
to Google Visualization API
Ok, thanks for the consideration.
Reply all
Reply to author
Forward
0 new messages