我正在尝试将d3.js可视化应用于2层层次数据(此示例具有4个层次)。尽管有很多麻烦,我还是很想让它正常工作。我有两个问题我什至不知道从哪里开始:
1)将JSON数据更改为局部变量,然后从php数组以所需格式提供变量 和 2)更改为分组的分层条形图。 (每当我寻求有关层次图和分组图的帮助时,我都会提出在两者之间转换的问题)
现在,我的数据存储在两个这样排列的php数组中
ZedGraph.ZedGraphControl zedGraphControl1 = new ZedGraph.zedGraphControl1();
ZedGraph.ZedGraphControl zedGraphControl2 = new ZedGraph.zedGraphControl2();
private void InitializeEvents()
{
zedGraphControl1.ZoomEvent += ZedGraphControl1_ZoomEvent;
edGraphControl2.ZoomEvent += ZedGraphControl2_ZoomEvent;
}
private void ZedGraphControl1_ZoomEvent(ZedGraph.ZedGraphControl sender,
ZedGraph.ZoomState oldState, ZedGraph.ZoomState newState)
{
double zoomFraction = sender.ZoomStepFraction;
PointF centerPt = this.deviceControl1.mousePt;
ZedGraph.GraphPane pane = sender.MasterPane.FindChartRect(centerPt);
//this.deviceControl2.zedGraphControl1.ZoomS
//ZoomPane(pane, zoomFraction, centerPt,
this.deviceControl1.zedGraphControl1.IsZoomOnMouseCenter);
}
private void ZedGraphControl2_ZoomEvent(ZedGraph.ZedGraphControl sender,
ZedGraph.ZoomState oldState, ZedGraph.ZoomState newState)
{
}
我当然有一个包含
的数组Array 1: FoodsAtStore1
FoodsAtStore1['GroupID1']['Apples'] = 3
FoodsAtStore1['GroupID1']['Bananas'] = 10
FoodsAtStore1['GroupID2']['Cheerios'] = 10
Array 2: FoodsAtStore2
FoodsAtStore2['GroupID1']['Apples'] = 40
FoodsAtStore2['GroupID1']['Bananas'] = 3
FoodsAtStore1['GroupID2']['Cheerios'] = 10