Lui*_*uiz 3 charts graph d3.js crossfilter dc.js
我有一个三线图的复合图表.其中一个图表是使用此处建议的"假"组.正如您在下面的快照中看到的那样,尽管第三个图表的比例与其他两个图表的比例非常不同.我想要的解决方案是在纯d3中显示双轴图表.我认为可以在主要的复合图表上使用.renderlet()来完成,但我想知道是否有一个纯粹的dc.js的"性感"解决方案?
这是一个快照:
这是我的代码.(在coffeescript中)我尝试在内部图表上使用.y和.yAxis,但这没有效果.
actualValuesChart = dc.lineChart(mainChart)
.group(metric, "actual " + @displayName)
.valueAccessor (d) -> d.value.avg
.colors(['green'])
.interpolate('basis-open')
normValuesChart = dc.lineChart(mainChart)
.group(metric, "normal " + @displayName)
.valueAccessor (d) -> d.value.avg_avg
.colors(['rgba(0,0,255,1)'])
.interpolate('basis-open')
clipsCountChart = dc.lineChart(mainChart)
.group(buildFakeGroup(defaultClipsArray))
.colors(['red'])
.interpolate('basis-open')
# .y(d3.scale.linear().range([100, 0]))
# .yAxis(d3.svg.axis().scale(d3.scale.linear().range([100, 0])))
mainChart
.dimension(@dimension.monthStamp)
.width(thisChart.width + 30)
.height(thisChart.width*.333)
.yAxisLabel(@displayName)
.elasticY(true)
.x(d3.time.scale().domain([minDate,maxDate]))
.xUnits(d3.time.months)
.brushOn(true)
.legend(dc.legend().x(60).y(10).itemHeight(13).gap(5))
.renderHorizontalGridLines(true)
.compose([actualValuesChart,normValuesChart,clipsCountChart])
Run Code Online (Sandbox Code Playgroud)