SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components
I asked a question about drawing color bands according to category and I am pointed to this thread
This seems to be the solution I am looking for, however, now I need to show category below the axis label but above the axis title… as shown in the attached image. currently what I did is to create style for AxisTitle to include another SciChart surface with dummy Y-Axis (disabling the MajorTicks, MinorTicks, Bands, Major/Minor gridlines) and one customized NumericAxis as given by the example shown in the thread.
I feel the code will be very complicated if I want to handle different axis type during run-time, may I know if there is any better way to accomplish this?
(P/S: how can I search back the questions that I have posted before if I didn’t bookmark it?)
Looking at this I would say the simplest way to achieve it is to have two charts.
SciChartSurface A. This is your main chart which has the line series on it, axis but no axis title
SciChartSurface B. This chart has your categories, an invisible YAxis, and an XAxis title.
The article you should look at is Linking multiple charts. This shows you how to have two charts synchronized.
Next, on your SciChartSurfaceB this is where you need to draw the categories. Use the technique from the other thread to draw them, or, you can use our CustomRenderableSeries API to draw polygons (fills) as well as text.
Let me know if this helps!
You can synchronize width of two charts using HorizontalGroupHelper. It defines the HorizontalChartGroup attached property, which you have to set to the same value on both SciChartSurfaces. We have a demo of how to do this in the “Vertical Charts” example:
<!-- The HorizontalChartGroup is used to synchronize axis area sizes and works like the SciChartGroup.VerticalChartGroup property, but for horizontal charts --> <s:SciChartSurface Name="sciChartLeft" Grid.Column="0" Margin="0 0 10 0" s:HorizontalGroupHelper.HorizontalChartGroup="MyHorizontalGroup"> .... </s:SciChartSurface> <!-- Declare the second surface and synchronize its width with the first one setting HorizontalChartGroup --> <s:SciChartSurface Name="sciChartRight" Grid.Column="1" s:HorizontalGroupHelper.HorizontalChartGroup="MyHorizontalGroup"> .... </s:SciChartSurface>
Besides that, you will probably need to bind the VisibleRanges of both XAxes together.
Hope this helps,
Please login first to submit.