User (Legacy) Posted February 12, 2007 Report Share Posted February 12, 2007 I added a second Y axis to the right side of the graph and assigned the series to it. It works (I am able to set the gridlines, title, etc.) until I set a max value and then neither the line nor the axis is displayed. AxisY AddlAxisY = new AxisY(); // AddlAxisY.Max = 25; // if this line is enabled, the line and the axis disapears. (the largest value is 20) AddlAxisY.Visible = true; AddlAxisY.Position = AxisPosition.Far; AddlAxisY.Title.Text = "Second Y Axis"; AddlAxisY.ForceZero = true; AddlAxisY.Grids.Major.Visible = false; AddlAxisY.Grids.Minor.Visible = false; Chart.AxesY.Add(AddlAxisY); Chart.Series[3].AxisY = AddlAxisY; // this is the last of the 4 series on the graph. Link to comment Share on other sites More sharing options...
Software FX Posted February 13, 2007 Report Share Posted February 13, 2007 Try setting the Min as well. Setting the Max causes AutoScale to be turned off leaving the Min at an undefined value. -- Francisco Padron www.chartfx.com Link to comment Share on other sites More sharing options...
slb_ctc Posted August 29, 2008 Report Share Posted August 29, 2008 I ran into this problem myself and yes, setting both values makes it work. However, in my situation I cannot always set both of them. Usually, min is 0 if not set by the user, so I can assume that as default.But Max is based on the data. Is it possible to autocalculate the max or somehow let the charting engine decide what the maximum is for the secondary Y-axis? I could find the max myself but letting the chart decide will be much more elegant solution. Link to comment Share on other sites More sharing options...
Frank Posted September 2, 2008 Report Share Posted September 2, 2008 If the Secondary Y-Axis is set to AutoScale, you can call RecalcScale to adjust it Min and Max so that they fit the data. After calling RecalcScale, you can set AutoScale to False and the Min and Max to the values you want, you can obtain the value for the Max right after calling RecalcScale to set it back. For example: chart.AxisY2.AutoScale = true; chart.RecalcScale(); double min = chart.AxisY2.Min; double max = chart.AxisY2.Max; chart.AxisY2.AutoScale = false; chart.AxisY2.Min = min; // Or the Min set by the user chart.AxisY2.Max = max; // Or the Max set by the user Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.