简体   繁体   English

使用Google Charts API更改面积图中线的颜色

[英]Colour change of the line in area chart using google Charts API

I have a line chart created in Google Charts API, Now I want to change the LIne Colour and body colour differently,But when i created a chart i can see line and body colour same , please can any one let me know how to change the colours using google API 我在Google Charts API中创建了一个折线图,现在我想以不同的方式更改线色和车身颜色,但是当我创建一个图表时,可以看到相同的线形和车身颜色,请让我知道如何更改使用Google API的颜色

<html>
  <head>
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
      google.load("visualization", "1", {packages:["corechart"]});
      google.setOnLoadCallback(drawChart);
      function drawChart() {
        var data = google.visualization.arrayToDataTable([
          ['',''],
          ['',27],
          ['',25],
          ['',60],
          ['',31],
          ['',25],        
          ['',39],        
          ['',25],
          ['',31],
          ['',26],
          ['',28],        
          ['',80],          
          ['',28],
          ['',27],
          ['',31],
          ['',27],        
          ['',29],        
          ['',26],
          ['',35],
          ['',70],
          ['',25]             
        ]);
        var options = {   
                backgroundColor: {
                    stroke: '#4322c0',
                    strokeWidth: 3},
                'is3D':true,
                series: {0:{color:'#DF013A',lineWidth:2}},
                colors:['#D8D8D8'],
                backgroundColor: "transparent",
                legend: {position: 'none'}
        };
        var chart = new google.visualization.AreaChart(document.getElementById('chart_div'));
        chart.draw(data, options);
      }
    </script>
  </head>
  <body>
    <div id="chart_div" style="width: 300px; height: 300px;"></div>
  </body>
</html>
  <body>
    <div id="chart_div"></div>
  </body>
</html>

Please refer the below developer documentation to change the line series color and the background color: 请参考以下开发者文档以更改线系列颜色和背景色:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM