You just need to combine the returned value from the first with the split
in the second:
view.setColumns([0, {
type: 'number',
label: 'mail',
calc: function (dt, row) {
var day = dt.getValue(row, 0);
return (day != 2) ? {v: dt.getValue(row, 1) / 1000000, f: dt.
getFormattedValue(row, 1)} : null;
}
}, {
type: 'number',
label: 'mail',
calc: function (dt, row) {
var day = dt.getValue(row, 0);
return (day == 2) ? {v: dt.getValue(row, 1) / 1000000, f: dt.
getFormattedValue(row, 1)} : null;
}
}]);
On Tuesday, November 13, 2012 3:02:07 PM UTC-5, cavan wrote:
>
> Hello,
>
> I try to chnage Y axis format and color of certain columns using setColumn
> function. Only one of them work, but not both of them. Here is the code
>
> var view = new google.visualization.DataView(data);
> view.setColumns([0, {
> //label: chartInfo.data.getColumnLabel(1),
> type: 'number',
> label: 'mail',
> calc: function (dt, row) {
> // reformat the data in millions
> return {v:dt.getValue(row, 1)/1000000, f:dt.getFormattedValue(row,
> 1)};
> }
> },
> {
> type: 'number',
> label: 'mail',
> calc: function (dt, row) { day=dt.getValue(row,0);
> return (day!=2) ? dt.getValue(row, 1) : null;
> }
> }, {
> type: 'number',
> label: 'mail',
> calc: function (dt, row) {day=dt.getValue(row,0);
> return (day==2) ? dt.getValue(row, 1) : null;
> }
> }]);
>
> So, I try to put in Y axis mln instead of six zeros and make columns
> different color if label is 2 or not.
>
> If I do the following
> view.setColumns([0, {
> //label: chartInfo.data.getColumnLabel(1),
> type: 'number',
> label: 'mail',
> calc: function (dt, row) {
> // reformat the data in millions
> return {v:dt.getValue(row, 1)/1000000, f:dt.getFormattedValue(row,
> 1)};
> }
> }
> )]
>
> The Y axis labeling works. And if I do the following
> view.setColumns([0, {
> type: 'number',
> label: 'mail',
> calc: function (dt, row) { day=dt.getValue(row,0);
> return (day!=2) ? dt.getValue(row, 1) : null;
> }
> }, {
> type: 'number',
> label: 'mail',
> calc: function (dt, row) {day=dt.getValue(row,0);
> return (day==2) ? dt.getValue(row, 1) : null;
> }
> }]);
>
> the coloring works.
> I need to impose both properties.
> How can it be accomplished?
>
> Thanks in advance
> cavan.
>
>
>
--
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/-/xWceSPGbCwYJ.
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.