Google Line Charts. Remove extra gridlines or change their color












1














I've created google line chart with the following settings:



google.charts.load('current', {packages: ['corechart', 'line']});
google.charts.setOnLoadCallback(drawCharts);
function drawCharts() {
var options = {
backgroundColor:{fill:'transparent'},
legend:'none',
series:{0:{color:'#aa8e57'}},
lineWidth:4,
pointSize:7,
chartArea:{width: '86%'},
hAxis:{
textStyle:{color:'#ffffff',fontSize:12},
gridlines:{color:'#2a261d'},
baselineColor:'#b19c72'
},
vAxis:{
textStyle:{color:'#ffffff',fontSize:12},
gridlines:{color:'#2a261d'},
baselineColor:'#b19c72'
},
};

var dataMembers = new google.visualization.DataTable();
dataMembers.addColumn('string', 'Date');
dataMembers.addColumn('number', 'Users');
dataMembers.addRows([
['13.11.2018',5], ['14.11.2018',7], ['15.11.2018',10]
]);
var membersChart = new google.visualization.LineChart(document.getElementById('membersChart'));
membersChart.draw(dataMembers, options);
}


I read all docs and cant find out how to customize those white extra lines:
enter image description here



I've done a lot of experiments, but i can't find out how they appears and how to remove them from the chart. Or at least, change their color to match rest of gridlines.










share|improve this question





























    1














    I've created google line chart with the following settings:



    google.charts.load('current', {packages: ['corechart', 'line']});
    google.charts.setOnLoadCallback(drawCharts);
    function drawCharts() {
    var options = {
    backgroundColor:{fill:'transparent'},
    legend:'none',
    series:{0:{color:'#aa8e57'}},
    lineWidth:4,
    pointSize:7,
    chartArea:{width: '86%'},
    hAxis:{
    textStyle:{color:'#ffffff',fontSize:12},
    gridlines:{color:'#2a261d'},
    baselineColor:'#b19c72'
    },
    vAxis:{
    textStyle:{color:'#ffffff',fontSize:12},
    gridlines:{color:'#2a261d'},
    baselineColor:'#b19c72'
    },
    };

    var dataMembers = new google.visualization.DataTable();
    dataMembers.addColumn('string', 'Date');
    dataMembers.addColumn('number', 'Users');
    dataMembers.addRows([
    ['13.11.2018',5], ['14.11.2018',7], ['15.11.2018',10]
    ]);
    var membersChart = new google.visualization.LineChart(document.getElementById('membersChart'));
    membersChart.draw(dataMembers, options);
    }


    I read all docs and cant find out how to customize those white extra lines:
    enter image description here



    I've done a lot of experiments, but i can't find out how they appears and how to remove them from the chart. Or at least, change their color to match rest of gridlines.










    share|improve this question



























      1












      1








      1







      I've created google line chart with the following settings:



      google.charts.load('current', {packages: ['corechart', 'line']});
      google.charts.setOnLoadCallback(drawCharts);
      function drawCharts() {
      var options = {
      backgroundColor:{fill:'transparent'},
      legend:'none',
      series:{0:{color:'#aa8e57'}},
      lineWidth:4,
      pointSize:7,
      chartArea:{width: '86%'},
      hAxis:{
      textStyle:{color:'#ffffff',fontSize:12},
      gridlines:{color:'#2a261d'},
      baselineColor:'#b19c72'
      },
      vAxis:{
      textStyle:{color:'#ffffff',fontSize:12},
      gridlines:{color:'#2a261d'},
      baselineColor:'#b19c72'
      },
      };

      var dataMembers = new google.visualization.DataTable();
      dataMembers.addColumn('string', 'Date');
      dataMembers.addColumn('number', 'Users');
      dataMembers.addRows([
      ['13.11.2018',5], ['14.11.2018',7], ['15.11.2018',10]
      ]);
      var membersChart = new google.visualization.LineChart(document.getElementById('membersChart'));
      membersChart.draw(dataMembers, options);
      }


      I read all docs and cant find out how to customize those white extra lines:
      enter image description here



      I've done a lot of experiments, but i can't find out how they appears and how to remove them from the chart. Or at least, change their color to match rest of gridlines.










      share|improve this question















      I've created google line chart with the following settings:



      google.charts.load('current', {packages: ['corechart', 'line']});
      google.charts.setOnLoadCallback(drawCharts);
      function drawCharts() {
      var options = {
      backgroundColor:{fill:'transparent'},
      legend:'none',
      series:{0:{color:'#aa8e57'}},
      lineWidth:4,
      pointSize:7,
      chartArea:{width: '86%'},
      hAxis:{
      textStyle:{color:'#ffffff',fontSize:12},
      gridlines:{color:'#2a261d'},
      baselineColor:'#b19c72'
      },
      vAxis:{
      textStyle:{color:'#ffffff',fontSize:12},
      gridlines:{color:'#2a261d'},
      baselineColor:'#b19c72'
      },
      };

      var dataMembers = new google.visualization.DataTable();
      dataMembers.addColumn('string', 'Date');
      dataMembers.addColumn('number', 'Users');
      dataMembers.addRows([
      ['13.11.2018',5], ['14.11.2018',7], ['15.11.2018',10]
      ]);
      var membersChart = new google.visualization.LineChart(document.getElementById('membersChart'));
      membersChart.draw(dataMembers, options);
      }


      I read all docs and cant find out how to customize those white extra lines:
      enter image description here



      I've done a lot of experiments, but i can't find out how they appears and how to remove them from the chart. Or at least, change their color to match rest of gridlines.







      charts google-visualization






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 20 at 23:13









      WhiteHat

      35.6k61475




      35.6k61475










      asked Nov 20 at 22:22









      sbxmal

      49031129




      49031129
























          1 Answer
          1






          active

          oldest

          votes


















          2














          those are --> minorGridlines



          for the same color...



          minorGridlines:{color:'#2a261d'},


          to remove...



          minorGridlines:{count:0},


          see following working snippet...






          google.charts.load('current', {packages: ['corechart', 'line']});
          google.charts.setOnLoadCallback(drawCharts);
          function drawCharts() {
          var options = {
          backgroundColor:{fill:'transparent'},
          legend:'none',
          series:{0:{color:'#aa8e57'}},
          lineWidth:4,
          pointSize:7,
          chartArea:{width: '86%'},
          hAxis:{
          textStyle:{color:'#ffffff',fontSize:12},
          gridlines:{color:'#2a261d'},
          minorGridlines:{color:'#2a261d'},
          baselineColor:'#b19c72'
          },
          vAxis:{
          textStyle:{color:'#ffffff',fontSize:12},
          gridlines:{color:'#2a261d'},
          minorGridlines:{color:'#2a261d'},
          baselineColor:'#b19c72'
          },
          };

          var dataMembers = new google.visualization.DataTable();
          dataMembers.addColumn('string', 'Date');
          dataMembers.addColumn('number', 'Users');
          dataMembers.addRows([
          ['13.11.2018',5], ['14.11.2018',7], ['15.11.2018',10]
          ]);
          var membersChart = new google.visualization.LineChart(document.getElementById('membersChart'));
          membersChart.draw(dataMembers, options);
          }

          body {
          background-color: #000000;
          }

          #membersChart {
          height: 600px;
          width: 800px;
          }

          <script src="https://www.gstatic.com/charts/loader.js"></script>
          <div id="membersChart"></div>








          share|improve this answer





















          • It works, thanks! Can you also explain why the vertical lines doesn't shows up ? If i change column type from "string" to "date" - they are visible then.
            – sbxmal
            Nov 23 at 13:37












          • that's the reason, they appear for a continuous axis (date, number, etc.) and not for a discrete axis (string) -- see discrete vs continuous
            – WhiteHat
            Nov 23 at 14:24











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53402486%2fgoogle-line-charts-remove-extra-gridlines-or-change-their-color%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          2














          those are --> minorGridlines



          for the same color...



          minorGridlines:{color:'#2a261d'},


          to remove...



          minorGridlines:{count:0},


          see following working snippet...






          google.charts.load('current', {packages: ['corechart', 'line']});
          google.charts.setOnLoadCallback(drawCharts);
          function drawCharts() {
          var options = {
          backgroundColor:{fill:'transparent'},
          legend:'none',
          series:{0:{color:'#aa8e57'}},
          lineWidth:4,
          pointSize:7,
          chartArea:{width: '86%'},
          hAxis:{
          textStyle:{color:'#ffffff',fontSize:12},
          gridlines:{color:'#2a261d'},
          minorGridlines:{color:'#2a261d'},
          baselineColor:'#b19c72'
          },
          vAxis:{
          textStyle:{color:'#ffffff',fontSize:12},
          gridlines:{color:'#2a261d'},
          minorGridlines:{color:'#2a261d'},
          baselineColor:'#b19c72'
          },
          };

          var dataMembers = new google.visualization.DataTable();
          dataMembers.addColumn('string', 'Date');
          dataMembers.addColumn('number', 'Users');
          dataMembers.addRows([
          ['13.11.2018',5], ['14.11.2018',7], ['15.11.2018',10]
          ]);
          var membersChart = new google.visualization.LineChart(document.getElementById('membersChart'));
          membersChart.draw(dataMembers, options);
          }

          body {
          background-color: #000000;
          }

          #membersChart {
          height: 600px;
          width: 800px;
          }

          <script src="https://www.gstatic.com/charts/loader.js"></script>
          <div id="membersChart"></div>








          share|improve this answer





















          • It works, thanks! Can you also explain why the vertical lines doesn't shows up ? If i change column type from "string" to "date" - they are visible then.
            – sbxmal
            Nov 23 at 13:37












          • that's the reason, they appear for a continuous axis (date, number, etc.) and not for a discrete axis (string) -- see discrete vs continuous
            – WhiteHat
            Nov 23 at 14:24
















          2














          those are --> minorGridlines



          for the same color...



          minorGridlines:{color:'#2a261d'},


          to remove...



          minorGridlines:{count:0},


          see following working snippet...






          google.charts.load('current', {packages: ['corechart', 'line']});
          google.charts.setOnLoadCallback(drawCharts);
          function drawCharts() {
          var options = {
          backgroundColor:{fill:'transparent'},
          legend:'none',
          series:{0:{color:'#aa8e57'}},
          lineWidth:4,
          pointSize:7,
          chartArea:{width: '86%'},
          hAxis:{
          textStyle:{color:'#ffffff',fontSize:12},
          gridlines:{color:'#2a261d'},
          minorGridlines:{color:'#2a261d'},
          baselineColor:'#b19c72'
          },
          vAxis:{
          textStyle:{color:'#ffffff',fontSize:12},
          gridlines:{color:'#2a261d'},
          minorGridlines:{color:'#2a261d'},
          baselineColor:'#b19c72'
          },
          };

          var dataMembers = new google.visualization.DataTable();
          dataMembers.addColumn('string', 'Date');
          dataMembers.addColumn('number', 'Users');
          dataMembers.addRows([
          ['13.11.2018',5], ['14.11.2018',7], ['15.11.2018',10]
          ]);
          var membersChart = new google.visualization.LineChart(document.getElementById('membersChart'));
          membersChart.draw(dataMembers, options);
          }

          body {
          background-color: #000000;
          }

          #membersChart {
          height: 600px;
          width: 800px;
          }

          <script src="https://www.gstatic.com/charts/loader.js"></script>
          <div id="membersChart"></div>








          share|improve this answer





















          • It works, thanks! Can you also explain why the vertical lines doesn't shows up ? If i change column type from "string" to "date" - they are visible then.
            – sbxmal
            Nov 23 at 13:37












          • that's the reason, they appear for a continuous axis (date, number, etc.) and not for a discrete axis (string) -- see discrete vs continuous
            – WhiteHat
            Nov 23 at 14:24














          2












          2








          2






          those are --> minorGridlines



          for the same color...



          minorGridlines:{color:'#2a261d'},


          to remove...



          minorGridlines:{count:0},


          see following working snippet...






          google.charts.load('current', {packages: ['corechart', 'line']});
          google.charts.setOnLoadCallback(drawCharts);
          function drawCharts() {
          var options = {
          backgroundColor:{fill:'transparent'},
          legend:'none',
          series:{0:{color:'#aa8e57'}},
          lineWidth:4,
          pointSize:7,
          chartArea:{width: '86%'},
          hAxis:{
          textStyle:{color:'#ffffff',fontSize:12},
          gridlines:{color:'#2a261d'},
          minorGridlines:{color:'#2a261d'},
          baselineColor:'#b19c72'
          },
          vAxis:{
          textStyle:{color:'#ffffff',fontSize:12},
          gridlines:{color:'#2a261d'},
          minorGridlines:{color:'#2a261d'},
          baselineColor:'#b19c72'
          },
          };

          var dataMembers = new google.visualization.DataTable();
          dataMembers.addColumn('string', 'Date');
          dataMembers.addColumn('number', 'Users');
          dataMembers.addRows([
          ['13.11.2018',5], ['14.11.2018',7], ['15.11.2018',10]
          ]);
          var membersChart = new google.visualization.LineChart(document.getElementById('membersChart'));
          membersChart.draw(dataMembers, options);
          }

          body {
          background-color: #000000;
          }

          #membersChart {
          height: 600px;
          width: 800px;
          }

          <script src="https://www.gstatic.com/charts/loader.js"></script>
          <div id="membersChart"></div>








          share|improve this answer












          those are --> minorGridlines



          for the same color...



          minorGridlines:{color:'#2a261d'},


          to remove...



          minorGridlines:{count:0},


          see following working snippet...






          google.charts.load('current', {packages: ['corechart', 'line']});
          google.charts.setOnLoadCallback(drawCharts);
          function drawCharts() {
          var options = {
          backgroundColor:{fill:'transparent'},
          legend:'none',
          series:{0:{color:'#aa8e57'}},
          lineWidth:4,
          pointSize:7,
          chartArea:{width: '86%'},
          hAxis:{
          textStyle:{color:'#ffffff',fontSize:12},
          gridlines:{color:'#2a261d'},
          minorGridlines:{color:'#2a261d'},
          baselineColor:'#b19c72'
          },
          vAxis:{
          textStyle:{color:'#ffffff',fontSize:12},
          gridlines:{color:'#2a261d'},
          minorGridlines:{color:'#2a261d'},
          baselineColor:'#b19c72'
          },
          };

          var dataMembers = new google.visualization.DataTable();
          dataMembers.addColumn('string', 'Date');
          dataMembers.addColumn('number', 'Users');
          dataMembers.addRows([
          ['13.11.2018',5], ['14.11.2018',7], ['15.11.2018',10]
          ]);
          var membersChart = new google.visualization.LineChart(document.getElementById('membersChart'));
          membersChart.draw(dataMembers, options);
          }

          body {
          background-color: #000000;
          }

          #membersChart {
          height: 600px;
          width: 800px;
          }

          <script src="https://www.gstatic.com/charts/loader.js"></script>
          <div id="membersChart"></div>








          google.charts.load('current', {packages: ['corechart', 'line']});
          google.charts.setOnLoadCallback(drawCharts);
          function drawCharts() {
          var options = {
          backgroundColor:{fill:'transparent'},
          legend:'none',
          series:{0:{color:'#aa8e57'}},
          lineWidth:4,
          pointSize:7,
          chartArea:{width: '86%'},
          hAxis:{
          textStyle:{color:'#ffffff',fontSize:12},
          gridlines:{color:'#2a261d'},
          minorGridlines:{color:'#2a261d'},
          baselineColor:'#b19c72'
          },
          vAxis:{
          textStyle:{color:'#ffffff',fontSize:12},
          gridlines:{color:'#2a261d'},
          minorGridlines:{color:'#2a261d'},
          baselineColor:'#b19c72'
          },
          };

          var dataMembers = new google.visualization.DataTable();
          dataMembers.addColumn('string', 'Date');
          dataMembers.addColumn('number', 'Users');
          dataMembers.addRows([
          ['13.11.2018',5], ['14.11.2018',7], ['15.11.2018',10]
          ]);
          var membersChart = new google.visualization.LineChart(document.getElementById('membersChart'));
          membersChart.draw(dataMembers, options);
          }

          body {
          background-color: #000000;
          }

          #membersChart {
          height: 600px;
          width: 800px;
          }

          <script src="https://www.gstatic.com/charts/loader.js"></script>
          <div id="membersChart"></div>





          google.charts.load('current', {packages: ['corechart', 'line']});
          google.charts.setOnLoadCallback(drawCharts);
          function drawCharts() {
          var options = {
          backgroundColor:{fill:'transparent'},
          legend:'none',
          series:{0:{color:'#aa8e57'}},
          lineWidth:4,
          pointSize:7,
          chartArea:{width: '86%'},
          hAxis:{
          textStyle:{color:'#ffffff',fontSize:12},
          gridlines:{color:'#2a261d'},
          minorGridlines:{color:'#2a261d'},
          baselineColor:'#b19c72'
          },
          vAxis:{
          textStyle:{color:'#ffffff',fontSize:12},
          gridlines:{color:'#2a261d'},
          minorGridlines:{color:'#2a261d'},
          baselineColor:'#b19c72'
          },
          };

          var dataMembers = new google.visualization.DataTable();
          dataMembers.addColumn('string', 'Date');
          dataMembers.addColumn('number', 'Users');
          dataMembers.addRows([
          ['13.11.2018',5], ['14.11.2018',7], ['15.11.2018',10]
          ]);
          var membersChart = new google.visualization.LineChart(document.getElementById('membersChart'));
          membersChart.draw(dataMembers, options);
          }

          body {
          background-color: #000000;
          }

          #membersChart {
          height: 600px;
          width: 800px;
          }

          <script src="https://www.gstatic.com/charts/loader.js"></script>
          <div id="membersChart"></div>






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 20 at 23:13









          WhiteHat

          35.6k61475




          35.6k61475












          • It works, thanks! Can you also explain why the vertical lines doesn't shows up ? If i change column type from "string" to "date" - they are visible then.
            – sbxmal
            Nov 23 at 13:37












          • that's the reason, they appear for a continuous axis (date, number, etc.) and not for a discrete axis (string) -- see discrete vs continuous
            – WhiteHat
            Nov 23 at 14:24


















          • It works, thanks! Can you also explain why the vertical lines doesn't shows up ? If i change column type from "string" to "date" - they are visible then.
            – sbxmal
            Nov 23 at 13:37












          • that's the reason, they appear for a continuous axis (date, number, etc.) and not for a discrete axis (string) -- see discrete vs continuous
            – WhiteHat
            Nov 23 at 14:24
















          It works, thanks! Can you also explain why the vertical lines doesn't shows up ? If i change column type from "string" to "date" - they are visible then.
          – sbxmal
          Nov 23 at 13:37






          It works, thanks! Can you also explain why the vertical lines doesn't shows up ? If i change column type from "string" to "date" - they are visible then.
          – sbxmal
          Nov 23 at 13:37














          that's the reason, they appear for a continuous axis (date, number, etc.) and not for a discrete axis (string) -- see discrete vs continuous
          – WhiteHat
          Nov 23 at 14:24




          that's the reason, they appear for a continuous axis (date, number, etc.) and not for a discrete axis (string) -- see discrete vs continuous
          – WhiteHat
          Nov 23 at 14:24


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53402486%2fgoogle-line-charts-remove-extra-gridlines-or-change-their-color%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Wiesbaden

          Marschland

          Dieringhausen