[英]show row chart after clicking a other chart (dc.js)
I have two row charts and need to show the 2nd chart after i clicked (selectetd one) on the first row chart. 我有两个折线图,在单击(选中一个)第一个折线图后,需要显示第二个折线图。 how can i make it?
我该怎么做?
I can't add a js fiddle, because i'm getting my data from a database. 我无法添加js小提琴,因为我是从数据库中获取数据的。
var TestCaseRow = dc.rowChart("#TestCaserowchart");
var TestCaseDim = perfData.dimension(function (d) {
return d.TestCase;
});
var clickGroup = TestCaseDim.group().reduceCount(function (d) {
return d.x;
});
var filtered_groupTestCase = remove_empty_bins(clickGroup);
TestCaseRow
.width(1100)
.height(filtered_groupTestCase.all().length*18)
.margins({ top: 5, left: 10, right: 10, bottom: 20 })
.dimension(TestCaseDim)
.group(filtered_groupTestCase)
.elasticX(true);
//my other row chart
var testscriptRow = dc.rowChart("#testscriptrowchart");
var testscriptDim = perfData.dimension(function (d) {
return d.TestScript;
});
var ClickTestscriptGroup = testscriptDim.group().reduceCount(function (d) {
return d.x;
});
var filtered_groupTestScript = remove_empty_bins(ClickTestscriptGroup);
testscriptRow
.width(1100)
.height(filtered_groupTestScript.all().length*40)
.margins({ top: 5, left: 10, right: 10, bottom: 20 })
.dimension(testscriptDim)
.group(filtered_groupTestScript)
.elasticX(true);
Register an event-handler on the first chart with .on('filtered', function(chart, filter){...})
. 使用
.on('filtered', function(chart, filter){...})
在第一张图表上注册事件处理程序。 Within that function, check if the 2nd chart is displayed and if it is not, do whatever you need to do to display it. 在该功能内,检查是否显示了第二个图表,如果没有显示,请执行任何操作以显示它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.