Dear All,

I want to make 10 gridlines in the chart and want to show the no of files 
on vAxis. When no of files are 6 the chart is showing as in attachment.
Also the bar ended not at 6.
vAxis values are not growing in sequence. Used API 
: https://www.google.com/jsapi

Script file is also attached.

Can anyone help asap.


Thanks,
Ramakrishna

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/2ed1e3c1-e248-4080-bbb7-c235896f2535%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
//Controller for managing ricoh report
function RicohReportController() {
    var self = this;

    //Controller initialisation
    self.init = function (getReportDataUrl, googleCharts) {
        self.getReportDataUrl = getReportDataUrl;
        self.googleCharts = googleCharts;

        self.googleCharts.load("visualization", "1", { packages: ["corechart"] 
});
        debugger;
        self.googleCharts.setOnLoadCallback(self.getReportData);
        self.cachedData = null;

        $(window).resize(function () {
            self.drawChart(self.cachedData);
        });
    };

    self.getReportData = function() {
        $.ajax({
            url: self.getReportDataUrl,
            cache: false
        }).done(function (data) {
            self.cachedData = data;
            self.drawChart(data);
        });
    };

    self.drawChart = function (jsonData) {
        if (!jsonData) {
            return;
        }

        if (!jsonData.Lines || jsonData.Lines.length == 0) {
            $('#chart_div').html('<h5>' + jsonData.Message + '</h5>');
            self.initTooltip();
        } else {
            var data = new self.googleCharts.visualization.DataTable();

            data.addColumn('string', Application.messages.RicohChart_Date);
            data.addColumn('number', 
Application.messages.RicohChart_NumberOfFiles);
            data.addColumn({ type: 'string', role: 'style' });

            for (var i = 0; i < jsonData.Lines.length; i++) {
                data.addRow([jsonData.Lines[i].Date, 
jsonData.Lines[i].NumberOfFiles, 'color: #0099D7']);
            }

            //var gridlinesCount = 5;
            //if (jsonData.MaxNumber < 5) {
            //    gridlinesCount = jsonData.MaxNumber + 1;
            //}
            debugger;
            var gridlinesCount = 10;
            

            var options = {
                title: jsonData.Title,
                titleTextStyle: { fontSize: "18", color: "#444", bold: true },
                legend: 'none',
                vAxis: { format: '0', gridlines: { count: gridlinesCount }, 
title: Application.messages.RicohChart_NumberOfFiles, textStyle: { color: 
'#001500', fontSize: '12', padding: '100', margin: '100' } },
                hAxis: { direction: -1, slantedText: true, slantedTextAngle: 
90, textStyle: { color: 'black', fontSize: '12', paddingRight: '0', 
marginRight: '0' } },
                bar: { groupWidth: "70%" },
                height: 500,
                chartArea: { width: "90%", top: 60 }
            };

            var chart = new 
self.googleCharts.visualization.ColumnChart(document.getElementById('chart_div'));
            chart.draw(data, options);
        }
    };

    self.initTooltip = function() {
        $(function(a, b) {
            a(function() {
                a(".tooltip").each(function() {
                    var b = a(this).find(".tooltip-content");
                    a(this).tooltipster({
                        content: b,
                        contentAsHTML: !0,
                        interactive: !0,
                        position: "top"
                    });
                });
            });
        });
    };
}

Reply via email to