User (Legacy) Posted May 26, 2006 Report Share Posted May 26, 2006 I have a chart that has a constant 2 constant lines, one yellow and one red. The idea is to show a warning level and a danger level. For example, if a particlular rate starts to creap too high, it will first cross the warning line (Yellow). If it keeps creaping higher it will cross both the warning and the danger line (Red). The chart data is populated based on the users inputs and the constant line values also depend on the data. This is all setup dynamicly at runtime. The chart is a barchart. There is a line series that is sometimes displayed. ChartFX automaticly scales the chart depending on the data so that the chart looks nice which is fine. However, I would like to be able to make sure that the Constant lines are always visible in the chart area and also have at least a little space above and below them so that they are clearly distinct from the border of the charting area. In some cases (but not all) I do know the absolute maximum and minimum however it doesn't seem to be a good fix to always set this. For example, if I am chartign a Rate then I know that the values will always be from 0 to 100%. But in some cases the values always stay low, for example between 0 and 5%. So drawing a chart with a ranges from 0 to 100% just makes the data had to see along the bottom. I could set the Max (or Min) to just a little higher than the Red line but then if I had actual data values higher than the red line they they would get cut off. What is a good way to get the kind of formatting that I want? Thanks Zack Moore Link to comment Share on other sites More sharing options...
Software FX Posted May 26, 2006 Report Share Posted May 26, 2006 After setting the chart data and the constant lines, add the following code: chart1.AxisY.Max = Math.Max(chart1.AxisY.Max,constantLineValue); -- Francisco Padron www.chartfx.com Link to comment Share on other sites More sharing options...
User (Legacy) Posted May 26, 2006 Author Report Share Posted May 26, 2006 Thanks, that worked almost perfectly. The code you sent me would set the max to the red line and so when the red line was the highest thing in the chart it was flush against the top. I modified what you sent me to add 10% above the red line so it shows up better. m=Math.Max(chart1.AxisY.Max,decimal.ToDouble(qa.Standard.RedMin.Value)); m*=1.1; chart1.AxisY.Max = m; Thanks "SoftwareFX Support" <noreply@softwarefx.com> wrote in message news:GXUZnSQgGHA.1572@webserver3.softwarefx.com... > After setting the chart data and the constant lines, add the following > code: > > chart1.AxisY.Max = Math.Max(chart1.AxisY.Max,constantLineValue); > > -- > Francisco Padron > www.chartfx.com > Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.