SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components

0
0

hi support,

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?)

Version
4.1.1.8645
Images
  • You must to post comments
0
0

Hi there,

Looking at this I would say the simplest way to achieve it is to have two charts.

e.g.

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!

Best regards,
Andrew

  • How Yen Cheng
    hi Andrew,I tried to use different chart, but I face the challenge on ensuring my chart B align with my X-Axis’s width and position, for example, my Y-Axes will change during run-time, sometimes I will have multiple Y-Axes on left and right, when this happen, X-Axis my be resize, how to make my second chart to fit exactly the position and the width of my X-Axis?
  • You must to post comments
0
0

Hi there,

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,

Best regards,
Yuriy

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.