0

http://savedbythegoog.appspot.com/?id=d6fd6426f4f93a21e2ef806a2a88e6cc0576434e 请查看上面的链接。我想让最后一列标有“泥浆重量”的直线并保持其他线条平滑,但我总是让所有线条都笔直或平滑。

  google.load('visualization', '1', {packages: ['corechart']});

  function drawVisualization() {
    // Create and populate the data table.
    var data = google.visualization.arrayToDataTable([
      ['depth', 'pore pressure', 'pore +SM', 'frac. pressure', 'frac. -SM', 'mud weight'],
      [10500,  9.75,      10.25,         16.95,             16.45,           12],
      [11100,  11.5,      12,         17.35,             16.85,           12],
      [11099,  11.5,      12,         17.35,             16.85,           16.85],
      [12000,  15,      15.5,         17.8,             17.2,           16.85],
      [13000,  16,      16.5,         18.1,             17.6,           16.85],
      [14000,  16.35,      16.85,        18.4,             17.9,          16.85],
      [13999,  16.35,      16.85,        18.4,             17.9,          17.9],
      [16000,  16.8,      17.3,        18.7,             18.2,           17.9],
      [18000,  17.2,      17.7,        18.9,             18.4,           17.9],
      [19000,  17.4,      17.9,         19,             18.5,          17.9]
    ]);

    // Create and draw the visualization.
    var ac = new google.visualization.ComboChart(document.getElementById('visualization'));
    ac.draw(data, {
      title : 'pore pressure and fracture pressure',
      width: 600,
      height: 400,
      vAxis: {title: "Cups",direction:-1},
      hAxis: {title: "Month"},
      orientation: 'vertical',
      seriesType: "line",
      'smoothLine': true,
      series: {5: {type: "line",'smoothLine': false}}
    });
  }


  google.setOnLoadCallback(drawVisualization);

 <div id="visualization" style="width: 600px; height: 400px;"></div>
4

1 回答 1

1

而不是'smoothLine':true/false你应该使用curveType:'function'/'none'.

此外,您对该系列的索引不正确 - 该系列的索引为零,但您的depth列不计入此索引,因此该mud weight系列实际上是索引 4。

这是应该替换您的更新代码ac.draw(data, {...})

ac.draw(data, {
  title : 'pore pressure and fracture pressure',
  width: 600,
  height: 400,
  vAxis: {title: "Cups",direction:-1},
  hAxis: {title: "Month"},
  orientation: 'vertical',
  seriesType: "line",
  curveType: 'function',
  series: {4: {curveType: 'none'}}
});
于 2013-10-09T02:51:36.440 回答