How to reload data in Google Charts Calendar while keeping selected cell?

Viewed 882

I use jQuery and I use the following JS function to load and reload / redraw the Google Chart Calendar.

It works, however, it also removes the border from the selected item. I want to reload the calendar data, while keeping the currently selected item selected.

enter image description here

Any ideas?

function refreshCalendar( rows)
{
    //if( calendar != 0 )
    {
        calendar = new google.visualization.Calendar(document.getElementById('calendar_basic'))

        google.visualization.events.addListener(calendar, 'select', calendarSelectHandler);

        calendarData = new google.visualization.DataTable();
        calendarData.addColumn({ type: 'date', id: 'Date' });
        calendarData.addColumn({ type: 'number', id: 'Logs' });
        calendarData.addRows( rows );

        calendarOptions = {
            title: "Logs",
            height: 175,
            colorAxis: {minValue: 0,  colors: ['#FFFFFF', '#FF0000']},
            calendar: {
              focusedCellColor: {
                background: '#00FF00',
                stroke: '#004400',
                strokeOpacity: 1,
                strokeWidth: 2,
              },
              cellColor: {
                stroke: '#76a7fa',
                strokeOpacity: 0.5,
                strokeWidth: 1,
              }
            }
        };

        calendar.draw(calendarData, calendarOptions);
    }
}
2 Answers
Related