date formatter has no effect...

50 views
Skip to first unread message

T-Roy

unread,
May 6, 2012, 2:29:28 PM5/6/12
to google-visua...@googlegroups.com
I have introduced a date formatter for a data table that is used in a dashboard context, but it does not have an affect on the table output.  Here is a code snippet:


//var data is a dataTable object created with json from a server.

  var date_formatter_medium = new google.visualization.DateFormat({formatType:'medium'});
  date_formatter_medium.format(data,5);   //I have double and triple checked the column index

          table = new google.visualization.ChartWrapper({
            'chartType': 'Table',
            'containerId': 'chart3',
            'options': {
              'width': '670px',
              'allowHtml': true,
              'showRowNumber': true,
              'alternatingRowStyle': true,
              'height': 300,
              //'page': 'enable',
              //'pageSize': 10,
              //'hAxis': {'title': 'Assessment History'}
            },
           'view': {'columns': [1,2,3,4,5,6]}
          });

         // Create a dashboard
         new google.visualization.Dashboard(document.getElementById('dashboard')).
             // Establish bindings, declaring the both the slider and the category
             bind(schoolPicker, groupPicker).
             bind(groupPicker, userPicker).
             bind(userPicker, assessmentPicker).
             // slider and picker will drive both charts.  stackcol,table
             bind(assessmentPicker, [stackcol, table]).
             // Draw the entire dashboard.
             draw(data);
      }


The dashboard display ok, no errors.  However, the date field displays a very long date format such as

Sat Apr 21 2012 00:00:00 GMT-0600 (Mountain Daylight Time)

I am wondering if this is because the table definition creates a data view to show a subset of columns???

If so, how can I get around this?

Thanks for any ideas!


asgallant

unread,
May 7, 2012, 10:06:12 AM5/7/12
to google-visua...@googlegroups.com
What happens when you skip the dashboard and draw the Table with the data directly, ie:

table = new google.visualization.ChartWrapper({
    dataTable: data,

    'chartType': 'Table',
    'containerId': 'chart3',
    'options': {
        'width': '670px',
        'allowHtml': true,
        'showRowNumber': true,
        'alternatingRowStyle': true,
        'height': 300,
        //'page': 'enable',
        //'pageSize': 10,
        //'hAxis': {'title': 'Assessment History'}
    },
    'view': {'columns': [1,2,3,4,5,6]}
});
table.draw();
Reply all
Reply to author
Forward
0 new messages