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

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy. We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!

Please note: SciChart team will only answer questions from customers with active support subscriptions. Expired support questions will be ignored. If your support status shows incorrectly, contact us and we will be glad to help.

1
0

I am trying the SciChart evaluation version and still can’t figure out how to display a candlestick chart.

The SciChartSurface is placed at the root of a user control, which in turn shown as a tab in the main window:

<UserControl x:Class="Pipstudio.Datacenter.ChartWindow"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:SciChart="http://schemas.abtsoftware.co.uk/scichart"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300" xmlns:ams="http://schemas.amcharts.com/stock/wpf/2009/xaml" Loaded="UserControl_Loaded">

    <SciChart:SciChartSurface Name="sciChart" SciChart:ThemeManager.Theme="Chrome">

        <!-- Declare RenderableSeries -->
        <SciChart:SciChartSurface.RenderableSeries>
            <SciChart:FastCandlestickRenderableSeries/>
        </SciChart:SciChartSurface.RenderableSeries>

        <!-- Create an X Axis -->
        <SciChart:SciChartSurface.XAxis>
            <SciChart:CategoryDateTimeAxis>
                <SciChart:CategoryDateTimeAxis.GrowBy>
                    <SciChart:DoubleRange Min="0.0" Max="0.2"/>
                </SciChart:CategoryDateTimeAxis.GrowBy>                
            </SciChart:CategoryDateTimeAxis>
        </SciChart:SciChartSurface.XAxis>

        <!-- Create a Y Axis with GrowBy -->
        <SciChart:SciChartSurface.YAxis>
            <SciChart:NumericAxis>
                <SciChart:NumericAxis.GrowBy>
                    <SciChart:DoubleRange Min="0.1" Max="0.1"/>
                </SciChart:NumericAxis.GrowBy>
            </SciChart:NumericAxis>
        </SciChart:SciChartSurface.YAxis>

    </SciChart:SciChartSurface>

</UserControl>

The data points are manually appended in the Loaded event handler of the user control like this:

  var dataSeriesSet = new DataSeriesSet&lt;DateTime, double&gt;();
  sciChart.DataSet = dataSeriesSet;

  var series = dataSeriesSet.AddSeries();

  series.Append(new DateTime(2011, 1, 1), 1050, 1070, 1040, 1040);
  series.Append(new DateTime(2011, 1, 2), 1040, 1040, 1010, 1020);
  series.Append(new DateTime(2011, 1, 3), 1020, 1040, 1000, 1010);
  series.Append(new DateTime(2011, 1, 4), 1050, 1100, 1050, 1080);
  series.Append(new DateTime(2011, 1, 5), 1070, 1130, 1070, 1110);
  series.Append(new DateTime(2011, 1, 6), 1120, 1160, 1110, 1150); 

I expect to see 6 candles on the chart, but the result is quite different (see attachment). I have no idea why the samples work and mine doesn’t.

Any help would be appreciated. Thanks in advance.

Images
  • You must to post comments
1
0

Hi TTega, thanks for taking the time to make this post!

SciChart has two modes for axis ranging:

<

ol>

  • Full Auto: you set Axis.AutoRange to true and SciChart will zoom to fit new data as it is appended. In this mode you cannot set the Axis.VisibleRange as auto will override it.
  • Manual (Default): you set Axis.AutoRange to false, but you are responsible for setting VisibleRange or zooming to extents as new data is appended
  • The default mode is manual. In this case, after appending your data, you can either set the VisibleRange yourself or call ZoomExtents() on the SciChartSurface. e.g.

    Option 1: To Zoom to Extents:
    </br/>

    // Will cause SciChart to Zoom 
    // to fit in the X and Y direction
    sciChart.ZoomExtents();
    

    </br/>
    Option 2: To specify an X-range manually
    </br/>

    // Set the XAxis range
    sciChart.XAxis.VisibleRange = new DateRange(
       new DateTime(2011, 01, 01), 
       new DateTime(2011, 1, 06));
    
    // Zoom Extents in Y direction only 
    sciChart.ZoomExtentsY();
    

    </br/>
    Option 3: To specify X and Y ranges manually
    </br/>

    // Set the XAxis range
    sciChart.XAxis.VisibleRange = new DateRange(
       new DateTime(2011, 01, 01), 
       new DateTime(2011, 1, 06));
    
    // Zoom Extents in Y direction only 
    sciChart.YAxis.VisibleRange = new DoubleRange(
       1000, 1150);
    

    </br/>
    Option 4: Let SciChart AutoRange for you
    </br/>

    sciChart.XAxis.AutoRange = true;
    sciChart.YAxis.AutoRange = true;
    

    Let me know if this helps!

    • ttega
      Andrew,Thank you very much for quick reply.Information on how to automatically/manually set the visible range was very helpful.Since I could get it work by calling ZoomExtents(), I'm gonna try to fine-tune the chart appearance. :)
    • You must to post comments
    1
    0

    When using AutoRange is there any way of adding a margin? I’m currently showing a square wave on my chart and it would look better if it was not zoomed all the way to the extents on the window. See image attched.

    Thanks

    Simon

    Images
    • You must to post comments
    Showing 2 results
    Your Answer

    Please first to submit.