Javascript Google Chart:如何设置背景笔触颜色和大小?

时间:2017-06-18 10:28:16

标签: javascript charts google-visualization

我尝试添加背景颜色大小和颜色,但它对我不起作用。你能帮忙吗?

function drawChart() {

    var data = google.visualization.arrayToDataTable([
      ['Level', 'Total time in sec'],
      ['Level One',   totalTime ]
    ]);

    var options = {
      title: 'Statistics',
      backgroundColor: 'red'

      backgroundColor: {
        stroke: 'green',
        strokeWidth: 5
      },

    };

    var chart = new google.visualization.PieChart(document.getElementById('piechart'));


    chart.draw(data, options);
  }

此代码:     背景颜色: {         中风:'绿色',         strokeWidth:5       }, 不起作用

1 个答案:

答案 0 :(得分:0)

为什么要两次定义backgroundColor属性?

无论如何,你在“红色”之后错过了一个逗号:

    public MainWindowViewModel()
    {
        IpAdressCollection = new ObservableCollection<string>();

        var tmp = "192.168.1.";

        for (int i = 1; i <= 255; i++)
        {
            PingAdress(tmp+i.ToString());

        }
    }

    private void PingAdress(string adress)
    {
        try
        {
            Ping ping = new Ping();
            PingReply reply = ping.Send(adress);

            if(reply != null)
            {
                IPStatus status = reply.Status;
                IpAdressCollection.Add(status.ToString());
            }
        }
        catch (Exception ex)
        {

        }
    }