Hello ChartMan, Laurenty,
I seem to have bumped into this exact issue about 5 years later (october
2015). Sadly it seems it is still impossible in the JavaCharts JS API to
apply formatting/a pattern to a DataView.
In my case
var percPattern = view.getColumnPattern(1);
alert(JSON.stringify(percPattern)); // echo's "0.0%"
view.setColumns([0, { sourceColumn: 1, label: 'Coolness factor', type:
'number', ]);
alert(JSON.stringify(view.getColumnPattern(1))); // echo's "0.0%"
I am looking for a way to maintain the formatting, something like:
view.setColumns([0, { sourceColumn: 1, label: mbmChart.vAxisTitle, type:
'number', pattern: '#,#%' } ]); // '#,#%'
Or even a DataView.setColumnPattern() method to match the getter. But sadly
there is no such thing.
Am I missing something..?
Regards,
Bart
On Monday, July 12, 2010 at 6:55:51 PM UTC+2, laurenty wrote:
>
> Hi ChartMan,
>
> Let's say I have a DataTable with 3 columns: name (string), value1
> (number) and value2 (number)
> and I am formatting columns 1 and 2 with NumberFormat to display as
> percentages.
> I then create a DataView that will have a 4th column using 'calc' as a
> sum of columns 1, 2.
> There is no way to format the new calculated column as a percentage
> because cannot be used with DataView.
>
> Am I missing something?
>
> Thanks
>
> Laurent
>
> On Jul 12, 1:19 am, ChartMan <[email protected]> wrote:
> > Not sure what you are requesting here, if there are any standing issues
> > please describe the bug
> > or the feature request you are looking for.
> >
> > Thanks
> > ChartMan
> >
> > On Sun, Jul 11, 2010 at 8:43 PM, laurenty <[email protected]> wrote:
> > > Adding extra columns to the DataTable wouldn't work in this case as I
> > > have several views based on the same table and use them with charts.
> > > So you're saying that DataView supports calculated columns but that
> > > there is no way to format the data? That sounds like a design flaw to
> > > me...
> >
> > > I might just need to do all the calculations and formatting on the
> > > server side and use multiple DataTable objects, but this seems
> > > inefficient.
> >
> > > Thanks
> >
> > > Laurent
> >
> > > On Jul 10, 4:30 pm, KeithB <[email protected]> wrote:
> > > > Hi Laurent,
> >
> > > > It looks like Formatters (a PatternFormat in this case) can only be
> > > > applied to DataTables, not DataViews,
> >
> > > >
> http://code.google.com/apis/visualization/documentation/reference.htm...
> >
> > > > Can you specify the name/type/format of the computed column when
> > > > creating the DataTable and leave the values null until you create
> the
> > > > DataView?
> >
> > > > Good luck,
> > > > K
> >
> > > --
> > > 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] <javascript:>.
> > > To unsubscribe from this group, send email to
> > > [email protected] <javascript:><
> google-visualization-api%[email protected] <javascript:>>
> > > .
> > > 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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-visualization-api/94ce94f0-72a3-4764-a85a-606b48fb806e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.