--- a/ckanext/ga_report/public/scripts/ckanext_ga_reports.js +++ b/ckanext/ga_report/public/scripts/ckanext_ga_reports.js @@ -2,13 +2,17 @@ CKAN.GA_Reports = {}; CKAN.GA_Reports.render_rickshaw = function( css_name, data, mode, colorscheme ) { + var graphLegends = $('#graph-legend-container'); + if (!Modernizr.svg) { $("#chart_"+css_name) .html( '
Your browser does not support vector graphics. No graphs can be rendered.
') - .css('height','auto'); + .closest('.rickshaw_chart_container').css('height',50); + var myLegend = $('
') + .html('(Graph cannot be rendered)') + .appendTo(graphLegends); return; } - var graphLegends = $('#graph-legend-container'); var myLegend = $('
').appendTo(graphLegends); var palette = new Rickshaw.Color.Palette( { scheme: colorscheme } ); @@ -35,14 +39,9 @@ element: document.querySelector('#legend_'+css_name), graph: graph } ); - var hoverDetail = new Rickshaw.Graph.HoverDetail( { + var shelving = new Rickshaw.Graph.Behavior.Series.Toggle( { graph: graph, - formatter: function(series, x, y) { - var date = '' + new Date(x * 1000).toUTCString() + ''; - var swatch = ''; - var content = swatch + series.name + ": " + parseInt(y) + '
' + date; - return content; - } + legend: legend } ); graph.render(); };