Google charts y-axis label cutting off, I am using material charts

43 views
Skip to first unread message

zain.ab...@gmail.com

unread,
Nov 20, 2018, 11:12:57 AM11/20/18
to Google Chart API

Below is my google charts code, I have issue that my left label "Total" is cutting of, I used chartArea.left property here like this chartArea{left:214, width:500} but nothing changes. If anyone knows about what I am missing?

Please see that screenshot for how my chart is showing: https://prnt.sc/lkovdg



google
.charts.load("current", {packages:['bar']});
    google
.charts.setOnLoadCallback(drawBarChartAddedExperiences);
   
function drawBarChartAddedExperiences()
   
{
       
var data = new google.visualization.DataTable();

        data
.addColumn('string', 'Days');
        data
.addColumn('number', 'New experiences');

       
if(typeof experiences_added === 'undefined')
       
{
           
//do nothing
       
}
       
else
       
{
           
for (var i = 0; i < experiences_added.length; i++)
           
{

               
var dated = ""+experiences_added[i].dated+"";
               
var events_added = parseInt(experiences_added[i].events_added);
               
var dated_format = ""+experiences_added[i].dated_format+"";

                data
.addRow([dated, events_added]);

                data
.setRowProperty(i, 'dated_format', dated_format);
           
}

           
var view = new google.visualization.DataView(data);
           
/*
            view.setColumns([0, 1,
                                    { calc: "stringify",
                                      sourceColumn: 1,
                                      type: "string",
                                      role: "annotation"
                                    },
                                2]);
                                */


           
var options = {
                title
: new_exp_count,
               
//width: 5000,
                height
: 400,
                bar
: {
                    groupWidth
: "25%",
               
},
                legend
: {
                    position
: "none",
               
},
                titleTextStyle
: {
                    fontSize
: 22,
                    bold
: true,
                    color
:'#575655',
                   
//italic: true,
                    fontName
: 'sans-serif',
               
},
                hAxes
: {
                   
0: {
                        title
: 'Days',
                        textStyle
: {
                            bold
: true,
                            color
:'#575655',
                            fontSize
: 12,
                            fontName
: 'sans-serif',
                       
},
                   
}
               
},
                vAxis
: {
                    title
: 'Total',
                    viewWindow
: {min: 0, max: total_new_exp_count},
                     titleTextStyle
: {
                        bold
: true,
                        fontName
: 'sans-serif',
                       
//fontSize: '18',
                   
},
                    textStyle
: {
                        bold
: true,
                        color
:'#575655',
                       
//fontSize: 12,
                        fontName
: 'sans-serif',
                   
},
               
},
           
};
           
var chart = new google.charts.Bar(document.getElementById("new_experiences_in_a_duration"));

   
//chart.draw(view, options);
            chart
.draw(view, google.charts.Bar.convertOptions(options));





















Reply all
Reply to author
Forward
0 new messages