Hide/Highlight weekends on google charts

24 Views Asked by At

I have a google timeline chart that show some simple data, using the following code for testing.

google.charts.load('current', {'packages':['timeline']});
    google.charts.setOnLoadCallback(drawChart);

    function drawChart() {
        var container = document.getElementById('chart_div');
        var chart = new google.visualization.Timeline(container);
        var dataTable = new google.visualization.DataTable();
        
        dataTable.addColumn({ type: 'string', id: 'RowLabel' });
        dataTable.addColumn({ type: 'string', id: 'Category' }); 
        dataTable.addColumn({ type: 'date', id: 'Start' });      
        dataTable.addColumn({ type: 'date', id: 'End' });        


        dataTable.addRows([
            ['Event 1', 'Y', new Date(2012, 0, 1), new Date(2012, 0, 4)],
            ['Event 2', 'Y', new Date(2012, 0, 2), new Date(2012, 0, 7)],
            ['Event 3', 'area boundary', new Date(2012, 0, 2), new Date(2012, 0, 10)],
           
        ]);


        var options = {
            timeline: { colorByRowLabel: true },
            alternatingRowStyle: true
            
        };

        chart.draw(dataTable, options);
    }

My issue is that I need to either hide the columns that are weekend days (Saturday and Sunday) or highlight them, like a different background color only for these days.

I have already tried changing the background color of the specific columns, but had no success in doing so. Also tried searching for a way to hide them, but did not find anything about it. I noticed that it automatically makes the date on the label bold if it is a sunday, like you can see in the image below, so there must be an option fot that, right?

(Couldnt directly upload the image here, was getting some weird server error)

https://imgur.com/a/A7dMeZI

Is there anyway to achieve what I am looking for?

0

There are 0 best solutions below