谷歌折线图:虚线部分

Arn*_*aud 5 javascript charts google-visualization

是否可以将Google Line Chart的一个部分设为虚线?像这样:

在此输入图像描述

有一个certainty角色可以实现这一目标,但至少有两个细分,因为"当且仅当两个数据点都确定时,两个数据点之间的细分才是确定的"(请参阅https://developers.google.com/chart/interactive/docs/roles#what-roles-are-available)

Tho*_*tos 3

有一种方法,但不仅仅是 hack 官方解决方案,这里是一个例子:

 data.addColumn({type:'boolean',role:'certainty'}); // certainty col.

      data.addRows([
        [1,  41.8, true],
        [2,  32.4, true],//duplicate this
        [2,  32.4, false],
        [3,  25.7, true],
        [4,  10.5, true],
        [5,  10.4, true],
        [6,  7.7, true],
        [7,  9.6, true],
        [8,  10.6, true],
        [9,  14.8, true],
        [10, 11.6, true],
        [11, 4.7, true],
        [12, 5.2, true],
        [13, 3.6, true],
        [14, 3.4, true]
      ]);
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述