0

IMG

I have two issues in this google chart.

  1. I want to either get rid of the word Resour... on the right side or display the entire word.
  2. When I hover over any bar, I want to display the time or maybe both time and date for that data point

Here is my code to display the chart:

<script type='text/javascript'>
    google.load('visualization', '1', { 'packages': ['corechart'] });
    google.setOnLoadCallback(drawSizeChart);

    function drawSizeChart() {

        $.post('/metrics/GetSiteSize', { sID: "@Model.SiteId" },
        function (data) {

            var tdata = new google.visualization.DataTable();
            tdata.addColumn('string', 'Date');
            tdata.addColumn('number', 'Resources');

            for (var i = 0; i < data.length; i++) {
                var date = (new Date(parseInt(data[i].created_at.substr(6)))).toString().substring(4, 15);
                var rCount = data[i].resource_count;
                tdata.addRow([date, rCount]);
            }

            var options = {
                title: 'Resource Count',
                };

            var chart = new google.visualization.ColumnChart(document.getElementById('site_size'));
            chart.draw(tdata, options);
        });
    }
</script>
Glorfindel
  • 21,988
  • 13
  • 81
  • 109
SherCoder
  • 678
  • 2
  • 11
  • 26

1 Answers1

3

Accord to the top comment in this question, "it actually appears as though you can omit the chdl= parameter to get a scatter without a legend." Hope that helps. EDIT: Hah, I didn't read the whole thing.

Use...

legend: {position: 'none'}
Community
  • 1
  • 1
SwarthyMantooth
  • 1,799
  • 1
  • 15
  • 27
  • awesome that helped, thanks but do you think you can help me with my first issue which is displaying time when I hover over a single bar? – SherCoder Jun 12 '12 at 18:35
  • Sorry, I don't know Javascript :( Just figured I'd point you in the right direction for one of your problems. The follow link may help though. Good luck! :) https://developers.google.com/chart/interactive/docs/examples#mouseovertooltip – SwarthyMantooth Jun 12 '12 at 18:43