What would be the easiest way of changing the zero line on a mountain chart?
I am plotting seabed elevations along a particular route. These values are always negative. Rather than shading the area above the dataseries (up to a value of 0) I would like to the shading to happen below the series (up to a specified negative value, which I would set to a depth well below my deepest point).
I have considered:
+ shifting my data points and working with a custom label formatter
+ swapping chart surface background and mountain area colours, but then the gridlines appear on the wrong side of the series
I noticed from the documentation that there is a zeroCoord parameter in the protected RenderMountainArea method, but I’m not sure how to best override it…
Any suggestions?
- Jelle Muylle asked 10 years ago
- You must login to post comments
Hi there,
Please, try overriding the InternalDraw(..) method in this way:
protected override void InternalDraw(IRenderContext2D renderContext, IRenderPassData renderPassData) { var theDeepestPoint = -100; var zeroCoord = (float)(CurrentRenderPassData.IsVerticalChart ? Math.Min(Width + 1, CurrentRenderPassData.YCoordinateCalculator.GetCoordinate(theDeepestPoint)) : Math.Min(Height + 1, CurrentRenderPassData.YCoordinateCalculator.GetCoordinate(theDeepestPoint))); var gradientRotationAngle = GetChartRotationAngle(renderPassData); using (var areaBrush = renderContext.CreateBrush(AreaBrush, Opacity)) using (var linePen = renderContext.CreatePen(SeriesColor, AntiAliasing, StrokeThickness, Opacity)) { RenderMountainArea(renderContext, linePen, areaBrush, PointMarker, zeroCoord, gradientRotationAngle); } }
Does it do the trick?
UPDATED FOR SCICHART 3.0:
We’ve now added the property ZeroLineY to FastMountainRenderableSeries, so you can change this yourself. It also works for Column Series
////// Gets or sets the value which determines the zero line in Y direction. /// Used to set the bottom of a column, or the zero line in a mountain /// public double ZeroLineY { get { return (double)GetValue(ZeroLineYProperty); } set { SetValue(ZeroLineYProperty, value); } }
Best regards,
Yuriy
- Yuriy Zadereckiy answered 10 years ago
- last edited 10 years ago
-
Dear Yuriy, that does indeed work! Thanks, Jelle
- You must login to post comments
Please login first to submit.