Hello,
I would like to implement a simple FastColumnRenderableSeries with an HorizontalLineAnnotation. But I would like it to be sideways.
Here is my current code:
g = new FastColumnRenderableSeries(); colums = new UniformXyDataSeries<double>();> using (m_sciChartSurface.SuspendUpdates()) { colums.Append(1); } g.DataSeries = colums; m_sciChartSurface.RenderableSeries.Add(g);> m_xAxis = new NumericAxis(); m_yAxis = new NumericAxis(); m_sciChartSurface.XAxis = m_xAxis; m_sciChartSurface.YAxis = m_yAxis; m_xAxis.Visibility = System.Windows.Visibility.Hidden; m_yAxis.AutoRange = AutoRange.Never; m_yAxis.VisibleRange = new DoubleRange(-3, 2); HorizontalLineAnnotation hla = new HorizontalLineAnnotation(); hla.Y1 = 1; hla.StrokeThickness = 5; hla.Stroke = Brushes.Red; m_sciChartSurface.Annotations.Add(hla); m_xAxis.AxisAlignment = AxisAlignment.Left; m_xAxis.FlipCoordinates = true; m_yAxis.AxisAlignment = AxisAlignment.Top; m_yAxis.FlipCoordinates = true;
However, the HorizontalLineAnnotation behaves strangely.
Anny suggestions?
Thank you.
- Marc Vahldieck asked 2 years ago
- Good afternoon Marc, “behaves strangely” – how so? Do you have a video or something you can share?
- Hello, if I don’t use the last four lines to turn the Chart sideways, I have a normal vertical Column with a red Annotation-Line, just as expected: https://i.ibb.co/L09jf8v/Upright.jpg However, if I do add those lines, the Colum behaves as expected (turns sideways), but the Annotation is reduced to a short red line in the upper left corner: https://i.ibb.co/6wgKkxf/Sideways.jpg
- You must login to post comments
Hi Marc
Thanks for the images, those clarify the situation.
OK so what you’ve done is by setting XAxis.Alignment = Left and YAxis.Alignment = Top is created a Vertical Chart.
In SciChart, this axis orientation transposes the entire chart, and swaps X for Y throughout. It also rotates the chart 90 degrees.
You can still use annotations but you need to set HorizontalLineAnnotation.X1 in this case to get a horizontal line (because the chart is vertical / transposed / rotated 90 degrees).
Try this code:
<s:SciChartSurface >
<s:SciChartSurface.XAxis>
<s:NumericAxis AxisAlignment="Left" VisibleRange="0, 10" AxisTitle="XAxis Left"/>
</s:SciChartSurface.XAxis>
<s:SciChartSurface.YAxis>
<s:NumericAxis AxisAlignment="Top" VisibleRange="-5, 5" AxisTitle="YAxis Top"/>
</s:SciChartSurface.YAxis>
<s:SciChartSurface.Annotations>
<s:HorizontalLineAnnotation X1="5"/>
</s:SciChartSurface.Annotations>
</s:SciChartSurface>
This results in the following with SciChart WPF 7.0.1
Bet regards,
Andrew
- Andrew Burnett-Thompson answered 2 years ago
- You must login to post comments
Please login first to submit.