2

I'm working on google line chart and it is working fine but I want to hide time, when I hover at point it is showing complete date and time, I want only date not time how to hide time I search a lot but didn't find any solution and tried different parameters which I found on different forums but none of them work for me.

you can all see screen shot google line chart

as you can see date and time are mention and usage is 600 only date should be shown not time and my code is

    google.charts.load('current', {'packages':['line', 'corechart']});
    google.charts.setOnLoadCallback(drawChart);
    function drawChart() {
        var chartDiv = document.getElementById('chartDiv');
        var data = new google.visualization.DataTable();

        data.addColumn('date', 'Month');
        data.addColumn('number', "Sent");
        data.addColumn('number', "Signed");
        data.addColumn('number', "ID");
        data.addColumn('number', "Usage");

        data.addRows([
            [new Date(2017, 1, 2),   24,   57,    2,   12],
            [new Date(2017, 2, 4),   87,   87,    4,   45],
            [new Date("2017-03-05"),   54,   12,    6,   67],
            [new Date("2017-04-08"),   32,  153,    6,   87]
        ]);

        var materialOptions = {
                chart: {
                title: 'Chart of: (User 1)'
            },
            width: 1200,
            height: 600
        };

        function drawMaterialChart() {
            var materialChart = new google.charts.Line(chartDiv);
            materialChart.draw(data, materialOptions);
        }
        drawMaterialChart();
    }
user2727841
  • 715
  • 6
  • 21

1 Answers1

3

One simple solution may be to treat the date as a string, so

    data.addColumn('string', 'Month'); //<-- change type date for string
    data.addColumn('number', "Sent");
    data.addColumn('number', "Signed");
    data.addColumn('number', "ID");
    data.addColumn('number', "Usage");

    data.addRows([ // then change all new Date() for strings
        ["1/2/2017",   24,   57,    2,   12],
        ["2/4/2017",   87,   87,    4,   45],
        ["3/5/2017"),   54,   12,    6,   67],
        ["4/8/2017"),   32,  153,    6,   87]
    ]);
tiomno
  • 2,178
  • 26
  • 31
  • cannot do that because I need months name and in javascript I get month name easily so is their any other solution and easily to play/manipulate with javascript date function. – user2727841 May 15 '17 at 08:04
  • I found this too but parameters are different from my code http://stackoverflow.com/questions/32133792/how-do-i-align-date-and-values-to-gridlines-in-google-chart and showing only date not time and type is also date. – user2727841 May 15 '17 at 08:09