我具有2个折线图的复合图表但是我需要的第三图表添加到它。
这第三张图表将这些独特的性质:
- 该数据将通过Ajax呼叫进来,可作为二维阵列[[时间戳,值],[时间戳,值] ...]
- 每一个新的Ajax调用需要更换前一个的值
- 它不需要尊重任何过滤器,不会对任何其他图表使用
- 然而,将需要使用不同地缩放Y轴。(和右边标记的话)
这就是图目前的样子,只有图表二
这是我的代码与第三线图的开始......假设我有我在来处理这一点的最好/最简单的方法有点亏可用的新数据的阵列。
timeChart
.width(width).height(width*.333)
.dimension(dim)
.renderHorizontalGridLines(true)
.x(d3.time.scale().domain([minDate,maxDate]))
.xUnits(d3.time.months)
.elasticY(true)
.brushOn(true)
.legend(dc.legend().x(60).y(10).itemHeight(13).gap(5))
.yAxisLabel(displayName)
.compose([
dc.lineChart(timeChart)
.colors(['blue'])
.group(metric, "actual" + displayName)
.valueAccessor (d) -> d.value.avg
.interpolate('basis-open')
.dimension(dim),
dc.lineChart(timeChart)
.colors(['red'])
.group(metric, "Normal " + displayName)
.valueAccessor (d) -> d.value.avg_avg
.interpolate('basis-open'),
dc.lineChart(timeChart)
.colors(['#666'])
.y()#This needs to be scaled and labeled on the right side of the chart
.group() #I just want to feed a simple array of values into here
])
也侧面说明:我发现我可能是一个小bug与传说的渲染。 正如你可以在图例中看到这两个具有相同的标签,但我已经在第二。集团()的参数使用不同的字符串。