Pat Posted March 2, 2007 Report Share Posted March 2, 2007 I am trying to create a new Y Axis in the second pane of my graph. The new Y Axis does get created but the series moves from the second pane to the first/main pane in the graph. Quote Link to comment Share on other sites More sharing options...
Frank Posted March 2, 2007 Report Share Posted March 2, 2007 Please post the code that you are using to create the secondary y axis and assign the series to it. Quote Link to comment Share on other sites More sharing options...
Pat Posted March 2, 2007 Author Report Share Posted March 2, 2007 The code is below; case "New Y Axis": Label1.Text = " Case Y2 Axis: "; if (Chart1.Series[DropDownSeries.SelectedIndex].AxisY == Chart1.AxisY2) { Chart1.Personalize.AutoLoad = false; Label1.Text = Label1.Text + " If Condition matched, selected series axis " + Chart1.Series[DropDownSeries.SelectedIndex].AxisY; break; } else { Chart1.Personalize.AutoLoad = false; //Chart1.Series[DropDownSeries.SelectedIndex].AxisY = Chart1.AxisY[3]; //Chart1.Series[DropDownSeries.SelectedIndex].Pane = Chart1.Panes[1]; AxisY AddlAxisY = new AxisY(); AddlAxisY.TextColor = Chart1.Series[DropDownSeries.SelectedIndex].Color; AddlAxisY.Visible = true; AddlAxisY.Position = AxisPosition.Far; AddlAxisY.ForceZero = false; Chart1.AxesY.Add(AddlAxisY); Chart1.Series[DropDownSeries.SelectedIndex].AxisY = AddlAxisY; When I try to specify a Pane it does not generate the graph; Chart1.Series[DropDownSeries.SelectedIndex].Pane = Chart1.Panes[1]; Quote Link to comment Share on other sites More sharing options...
Pat Posted March 2, 2007 Author Report Share Posted March 2, 2007 I have a correction fro the reply posting. When I specify the Pane. The series stays in the second pane on the primary Y Axis. Quote Link to comment Share on other sites More sharing options...
Frank Posted March 2, 2007 Report Share Posted March 2, 2007 The semantics of: Chart1.Series[DropDownSeries.SelectedIndex].Pane = Chart1.Panes[1]; Is to move the series to the main Y-Axis of the second pane. Since you already assigned the series to the right axis, what you need to do now is to add that axis to the appropriate pane, not to the Main pane. Replace: Chart1.AxesY.Add(AddlAxisY); With: Chart1.Panes[1].AxesY.Add(AddlAxisY); Remove: Chart1.Series[DropDownSeries.SelectedIndex].Pane = Chart1.Panes[1]; Quote Link to comment Share on other sites More sharing options...
Pat Posted March 5, 2007 Author Report Share Posted March 5, 2007 Frank I tried your suggestion but the graph would not render. Am I doing something wrong? I do not see 'Add' as an option when building the line of code in Visual Studio after 'AxesY'. Quote Link to comment Share on other sites More sharing options...
Frank Posted March 5, 2007 Report Share Posted March 5, 2007 My mistake: Chart1.Panes[1].Axes.Add(AddlAxisY); Quote Link to comment Share on other sites More sharing options...
Pat Posted March 5, 2007 Author Report Share Posted March 5, 2007 It works fine. Thanks Quote Link to comment Share on other sites More sharing options...
Frank Posted March 16, 2007 Report Share Posted March 16, 2007 Good! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.