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

0
0

Hi,

Can I write SciStockChart with DateTimeAxis like:

        <s:SciStockChart SeriesSource="{Binding ChartManager.ChartData, 
                                                UpdateSourceTrigger=PropertyChanged, 
                                                Mode=TwoWay}" 
                         x:Name="SciChart"
                         YAxes="{Binding ChartManager.YAxes}"
                         s:ThemeManager.Theme="Chrome">
            <s:SciStockChart.XAxis>
                <s:DateTimeAxis DrawMinorTicks="True" 
                                DrawMinorGridLines="True" 
                                VisibleRange="{Binding ChartManager.XVisibleRange, 
                                                       UpdateSourceTrigger=PropertyChanged, 
                                                       Mode=TwoWay}"
                                DrawMajorGridLines="True"/>
            </s:SciStockChart.XAxis>
        </s:SciStockChart>

because I have exeption “Axis type DateTimeAxis requires that DataRange and VisibleRange is of type Abt.Controls.SciChart.DateRange”. The XVisibleRange is a IRange type.

Thanks,
Arthur

  • You must to post comments
1
0

Hi Arthur,

I tried to email you yesterday to discuss the many issues you are experiencing with SciStockChart. Did you receive it?

I have an idea for you. It seems like you want to extensively customize the SciStockChart control. Did you know that SciStockChart is simply a derived type of SciChartSurface, with default XAxis, YAxis and ChartModifiers built in?

It’s designed to make life easier for users who want a standard use case. However, you can actually create the exact same functionality as SciStockChart by using SciChartSurface. If you want to see an example, please see our SciTrader Demo which can be found online, or WPF samples can be found under the SciChart Install Directory. This is a far more flexible approach, but requires more code on your part.

If you want to customize SciStockChart by setting multiple YAxis and custom modifiers I would suggest considering this approach (using base class, SciChartSurface) instead. Also our Change Theme example uses multiple Y-Axis as well as standard DateTimeAxis.

Note that as per your query, CategoryDateTimeAxis requires that VisibleRange is of type IndexRange (indices to data), whereas DateTimeAxis requires that VisibleRange is of type DateRange (actual dates). DateTimeAxis will not collapse gaps in weekends or overnight like the CategoryDateTimeAxis does so this axis type is not very useful for stock charts unless you are displaying purely intraday data.

Please can you check these two examples. If you require further guidance, rather than create many forum requests, please explain to us what is your overall requirement (either here or on email) and we will do our best to help.

Best regards,
Andrew

  • Arthur Romanov
    Hi Andrew,Thank you for answer. I didn't received your mail. I think you are right, I will change SciStockChart to SciChartSurface. We are to display trade statistics data on a chart and I think don't need to use SciStockChart.Thanks, Arthur
  • Andrew
    Hi Arthur,Do you have any screenshots on what you want to achieve? Using this I can try to suggest a good way to do it.Best regards, Andrew
  • Arthur Romanov
    Hi Andrew,No, I haven't screenshots. I continuously get numeric data from service as YAxis and DateTime as XAxis and need a real time chart to render it. The chart should also support loading historical data on the fly when user drags or zooms out. What would be the best approach of achieving this?Thanks, Arthur
  • Andrew
    Hi Arthur,Screenshots or mocks help as from what you've said, I still don't realise why you need dual Y-axes, or if you want Candlestick or Line charts. Also what sort of data are you displaying? Are we talking about OHLC (e.g. price data) or do you need to plot something like bids/asks (e.g. just line charts)?Can you let me know how much data you want to plot (in number of points)? If its line charts and 10,000,000 or less you can just dump all the data into Scichart and it will sort out the display. Even OHLC/Candle it can cope with 2,000,000 points so there's no need to virtualize (load data dynamically on pan). Is there a reason why you can't do this?Finally you've asked before about loading data when panning back/forth, while this is something I believe can be done with Scichart (since you can hook into pan events, and reload data-series), we don't have any examples as yet. Do explain a bit more about the requirement and why you need this feature, we may be able to help.Best regards, Andrew
  • Arthur Romanov
    Hi Andrew,We need dual Y-axes since sometimes we want to see two different data series on the same chart. We want to display different kind of market data, so we will be using candlestick, hloc, and line charts.There could be millions of data points to display and we want to display the historical portion only on demand to avoid heavy initialization. Which chart should I use in that case? Also please note that we do not want the gaps to collapse (the way CategoryDateTimeAxis works).Thanks,Arthur
  • Andrew
    Ok - you can display two data-series on the same chart with a single YAxis, only different YAxes are needed if the two series have completely different ranges and you want them to scale separately, e.g. one is 0-100 and the other is 1000-2000 but you want both to zoom to fit.In our Silverlight Demo app we have a lot of dual axis examples where each axis auto-scales, so you can choose this option if you want it.Regarding millions of data-points, we've tested SciChart up to 2,000,000 OHLC bars or 10,000,000 points (line chart) and its still reasonably fast. So long as resampling is enabled (BaseRenderableSeries.ResamplingMode=MinMax) it will handle it. Simplest way is to just load everything and let the chart sort it out.A second way is to add a big arrow button to the left of the chart which you enable only when panning to earliest sample (Subscribe to XAxis.VisibleRangeChanged to determine if you are at the beginning). When clicked you load another 1-year of data (or however much you want). You can do this by iterating through the collection of DataSeries and either calling Insert, or (Faster) replace each dataseries with an entirely new dataseries with new data.A more complex way would be to subscribe to XAxis.VisibleRangeChanged and when the user scrolls near the edge, reload all DataSeries with more data, while keeping XAxis.VisibleRange constant.I don't have a code example for data-virtualisation, but I can point you at the SciTrader example which gives you a full functional stock chart and also supports the SeriesSource API.Hope this helps! Continue to post if you need more pointersAndrew
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.