How to customize “not enough columns given to draw the requested chart” message?

Is there any way to customize Google charts to prevent them from displaying this ‘red’ message? E.g., silently drawing nothing instead?


There is a bunch of events, methods and tools google charts / visualization offers for customizing error handling, error messages and so on.

For example, see or

According to what you are asking for, the easiest way would be to simply attach an errorhandler and in that handler, remove the error through google.visualization.errors.

Like this :

function errorHandler(errorMessage) {
    //curisosity, check out the error in the console

    //simply remove the error, the user never see it

function drawChart(json) {
    var data = new google.visualization.DataTable(json); //here, JSON is buggy
    var options = {
      title: 'test'
    var chart = new google.visualization.LineChart(document.getElementById('chart_div'));

    //attach the error handler here, before draw(), 'error', errorHandler);    

    chart.draw(data, options);

viola! Try add the errorHandler and, 'error', errorHandler); to your existing code, and see the difference (this is all you need).

Leave a Reply

Your email address will not be published. Required fields are marked *