Добрый день.
Как можно сделать в SciChart пропуски для свечек, если их действительно не было в некоторые периоды? По умолчанию рисуются все свечки одна за другой без пропусков, даже если между ними был временной разрыв. Из-за этого в одном окне невозможно 2 графика строить, т.к. они по времени не синхронизируются из-за пропусков свечек.
В Chart есть свойство IsIndexed, а в SciChart ничего такого нет. Подскажите как быть, плз.
Комментарии (13)
Вход или Создать аккаунт, Войдите или зарегистрируйтесь, чтобы оставить комментарий
Вопрос очень актуален. Неужели никто не пытается выводить в одном окне графики с двумя бумагами?
Спасибо, будем ждать
Еще, раз уж будете обновлять, может добавите Areas в этот элемент? А то больше двух не получается добавлять. Ошибки не выдает, но и не выводит.
Сейчас еще раз попробовал - работает,новые Areas добавляются. Как-то раньше почему-то больше двух не получалось (может, в коде что-то не так было).
Из того, что так и не выходит:
Не меняется высота области при выставлении свойства Height. Все дополнительные области "складываются" внизу под основной, приходится каждый раз их вытягивать, чтобы были видны.
На областях с индикаторами не всегда отражается ось времени. Например, в соседних областях размещаю по одному и тому же индикатору SMA, но с разными параметрами (длинная и короткая), но у одного нормально время отображается в перекрестии при наведении мыши, а у второго - все значения "1 янв 00:00"
Периодически при двойном клике на графике для получения общего обзора выходит необработаное ArgumentException '-бесконечность;бесконечность' is not a valid value for property 'To'. Кажется, это выходит когда в какой-то области элемент не успел отрисоваться, но системности я не смог уловить.
Вот Call Stack:
WindowsBase.dll!System.Windows.DependencyObject.SetValueCommon(System.Windows.DependencyProperty dp, object value, System.Windows.PropertyMetadata metadata, bool coerceWithDeferredReference, bool coerceWithCurrentValue, System.Windows.OperationType operationType, bool isInternal) WindowsBase.dll!System.Windows.DependencyObject.SetValueInternal(System.Windows.DependencyProperty dp, object value) PresentationCore.dll!System.Windows.Media.Animation.PointAnimation.To.set(System.Windows.Point? value) [Lightweight Function] Abt.Controls.SciChart.Wpf.dll!A.c231c9eef18428b3d735d79667b4dd1c6.c6dea473323fdce89c6d7460d087afc9c(object c2e4dcf306e5d5e570ccc0d688db6e42c, System.Windows.Point? c2e4dcf306e5d5e570ccc0d688db6e42c) Abt.Controls.SciChart.Wpf.dll!Abt.Controls.SciChart.AxisBase.AnimateVisibleRangeTo(Abt.Controls.SciChart.IRange to, System.TimeSpan duration) Abt.Controls.SciChart.Wpf.dll!Abt.Controls.SciChart.SciChartSurface.c54ff4239aa90b423c247e23c0dee02b5.c118b8c5c084fc71ffd85893c9650b255(System.Collections.Generic.KeyValuePair<Abt.Controls.SciChart.IAxis,Abt.Controls.SciChart.IRange> c9da477affcb37fcf973bebe5806f259d) Abt.Controls.SciChart.Wpf.dll!A.c3631c672e3fc9e342ac08ff1a63d428e.cacf72b657252e3e73860afb89d70cb9f<System.Collections.Generic.KeyValuePair<Abt.Controls.SciChart.IAxis,Abt.Controls.SciChart.IRange>>(System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<Abt.Controls.SciChart.IAxis,Abt.Controls.SciChart.IRange>> c40a30a1bb6416cd164565919fdef15a9, System.Action<System.Collections.Generic.KeyValuePair<Abt.Controls.SciChart.IAxis,Abt.Controls.SciChart.IRange>> c885aac61bc9832561b7ff07903c88d5e) Abt.Controls.SciChart.Wpf.dll!Abt.Controls.SciChart.SciChartSurface.AnimateZoomExtents(System.TimeSpan duration) Abt.Controls.SciChart.Wpf.dll!Abt.Controls.SciChart.ZoomExtentsModifier.OnModifierDoubleClick(Abt.Controls.SciChart.ModifierMouseArgs e) Abt.Controls.SciChart.Wpf.dll!Abt.Controls.SciChart.ModifierGroup.c9eef00ec0d5b3bf46425cfb74ef780be(Abt.Controls.SciChart.IChartModifier c6b1effd112e5355cd5f051dd91cd4f67, Abt.Controls.SciChart.ModifierMouseArgs cbb39038dde40bfc3fdcfa70f4bbf8778) [Lightweight Function] Abt.Controls.SciChart.Wpf.dll!A.ca14aa23cad73278e20adf8bb093cd5f5.c6dea473323fdce89c6d7460d087afc9c(object c2e4dcf306e5d5e570ccc0d688db6e42c, Abt.Controls.SciChart.IChartModifier c2e4dcf306e5d5e570ccc0d688db6e42c, Abt.Controls.SciChart.ModifierMouseArgs c2e4dcf306e5d5e570ccc0d688db6e42c) Abt.Controls.SciChart.Wpf.dll!Abt.Controls.SciChart.ModifierGroup.c9e8960a6a8527c20ac9e46e162c72b22(System.Action<Abt.Controls.SciChart.IChartModifier,Abt.Controls.SciChart.ModifierMouseArgs> c4bd4ab823835cf92d221476b6fb65a17, Abt.Controls.SciChart.ModifierMouseArgs c4c23d80d4d060e409c3479ef17d6c65e) Abt.Controls.SciChart.Wpf.dll!Abt.Controls.SciChart.ModifierGroup.OnModifierDoubleClick(Abt.Controls.SciChart.ModifierMouseArgs e) Abt.Controls.SciChart.Wpf.dll!Abt.Controls.SciChart.Utility.Mouse.MouseManager.c0dbdd9a5715f79ee4c780ad3e3187658(Abt.Controls.SciChart.ModifierMouseArgs cbb39038dde40bfc3fdcfa70f4bbf8778, Abt.Controls.SciChart.Utility.Mouse.IReceiveMouseEvents c18509698be3f9366c690e7d2b107b62c, bool c3791a1b71c1577bde30b55c12b2a5583) Abt.Controls.SciChart.Wpf.dll!Abt.Controls.SciChart.Utility.Mouse.MouseManager.c10b5e7bb389bad3d0e6691ea08c125df.c476c948474194a52ac99dfd8f26fce25.cdfac02806b4f3edef4600e0cc7315378(Abt.Controls.SciChart.Utility.Mouse.IReceiveMouseEvents c133657388cc0f6f6615e21e129ac4b3a) Abt.Controls.SciChart.Wpf.dll!A.c3631c672e3fc9e342ac08ff1a63d428e.cacf72b657252e3e73860afb89d70cb9f<Abt.Controls.SciChart.Utility.Mouse.IReceiveMouseEvents>(System.Collections.Generic.IEnumerable<Abt.Controls.SciChart.Utility.Mouse.IReceiveMouseEvents> c40a30a1bb6416cd164565919fdef15a9, System.Action<Abt.Controls.SciChart.Utility.Mouse.IReceiveMouseEvents> c885aac61bc9832561b7ff07903c88d5e) Abt.Controls.SciChart.Wpf.dll!Abt.Controls.SciChart.Utility.Mouse.MouseManager.c10b5e7bb389bad3d0e6691ea08c125df.cabad93bc507c319678a01e403af8be14(object cae49ecc8585f35e8dd5ce624f7fb7ab5, System.Windows.Input.MouseButtonEventArgs c4c23d80d4d060e409c3479ef17d6c65e) PresentationCore.dll!System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(System.Delegate genericHandler, object genericTarget) PresentationCore.dll!System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate handler, object target) PresentationCore.dll!System.Windows.RoutedEventHandlerInfo.InvokeHandler(object target, System.Windows.RoutedEventArgs routedEventArgs) PresentationCore.dll!System.Windows.EventRoute.InvokeHandlersImpl(object source, System.Windows.RoutedEventArgs args, bool reRaised) PresentationCore.dll!System.Windows.UIElement.ReRaiseEventAs(System.Windows.DependencyObject sender, System.Windows.RoutedEventArgs args, System.Windows.RoutedEvent newEvent) PresentationCore.dll!System.Windows.UIElement.OnMouseDownThunk(object sender, System.Windows.Input.MouseButtonEventArgs e) PresentationCore.dll!System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(System.Delegate genericHandler, object genericTarget) PresentationCore.dll!System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate handler, object target) PresentationCore.dll!System.Windows.RoutedEventHandlerInfo.InvokeHandler(object target, System.Windows.RoutedEventArgs routedEventArgs) PresentationCore.dll!System.Windows.EventRoute.InvokeHandlersImpl(object source, System.Windows.RoutedEventArgs args, bool reRaised) PresentationCore.dll!System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject sender, System.Windows.RoutedEventArgs args) PresentationCore.dll!System.Windows.UIElement.RaiseTrustedEvent(System.Windows.RoutedEventArgs args) PresentationCore.dll!System.Windows.UIElement.RaiseEvent(System.Windows.RoutedEventArgs args, bool trusted) PresentationCore.dll!System.Windows.Input.InputManager.ProcessStagingArea() PresentationCore.dll!System.Windows.Input.InputManager.ProcessInput(System.Windows.Input.InputEventArgs input) PresentationCore.dll!System.Windows.Input.InputProviderSite.ReportInput(System.Windows.Input.InputReport inputReport) PresentationCore.dll!System.Windows.Interop.HwndMouseInputProvider.ReportInput(System.IntPtr hwnd, System.Windows.Input.InputMode mode, int timestamp, System.Windows.Input.RawMouseActions actions, int x, int y, int wheel) PresentationCore.dll!System.Windows.Interop.HwndMouseInputProvider.FilterMessage(System.IntPtr hwnd, MS.Internal.Interop.WindowMessage msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) PresentationCore.dll!System.Windows.Interop.HwndSource.InputFilterMessage(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) WindowsBase.dll!MS.Win32.HwndWrapper.WndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) WindowsBase.dll!MS.Win32.HwndSubclass.DispatcherCallbackOperation(object o) WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs) WindowsBase.dll!MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(object source, System.Delegate method, object args, int numArgs, System.Delegate catchHandler) WindowsBase.dll!System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority priority, System.TimeSpan timeout, System.Delegate method, object args, int numArgs) WindowsBase.dll!MS.Win32.HwndSubclass.SubclassWndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam) [Native to Managed Transition] [Managed to Native Transition] WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame frame) WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame frame) WindowsBase.dll!System.Windows.Threading.Dispatcher.Run() PresentationFramework.dll!System.Windows.Application.RunDispatcher(object ignore) PresentationFramework.dll!System.Windows.Application.RunInternal(System.Windows.Window window) PresentationFramework.dll!System.Windows.Application.Run(System.Windows.Window window) PresentationFramework.dll!System.Windows.Application.Run() STest.exe!STest.App.Main() [Native to Managed Transition] [Managed to Native Transition] mscorlib.dll!System.AppDomain.ExecuteAssembly(string assemblyFile, System.Security.Policy.Evidence assemblySecurity, string[] args) Microsoft.VisualStudio.HostingProcess.Utilities.dll!Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() mscorlib.dll!System.Threading.ThreadHelper.ThreadStart_Context(object state) mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) mscorlib.dll!System.Threading.ThreadHelper.ThreadStart() [Native to Managed Transition]
Ну, а чтобы уже совсем рабочий график был, то хорошо бы перекрестие мыши не просто дату и значение показывало (т.е. просто координаты мыши), а находило бы свечу и/или индикатор и его бы показывало. Как в QUIKе или других терминалах.
Скриншоты сделайте где у вас что "складывается" и "неотриосовывается".
Вот так, все Areas явно в какой-то дефолтной ширине. Изменение Height не помогает.
Ок. С масштабом понятно.
Насчет этого
WindowsBase.dll!System.Windows.DependencyObject.SetValueCommon(System.Windows.DependencyProperty dp, object value, System.Windows.PropertyMetadata metadata, bool coerceWithDeferredReference, bool coerceWithCurrentValue, System.Windows.OperationType operationType, bool isInternal)
и этого
Судя по скрину у вас не последняя версия S#, обновитесь до последней, возможно ошибки не будет. Сейчас график выглядит так:
Да, действительно, не уследил за обновлениями. Теперь гораздо приятнее. Только вот с шириной областей разобраться, было бы совсем хорошо.
Кстати, было бы более юзабельное перекрестие, если бы оно появлялось не только при касании контура круга, который "ловит" свечу, но и если мышь находится внутри круга. Получается подводишь мышь к свече, появляется кружок, которого надо коснуться. Но если чуть скользнешь внутрь него, то перекрестие исчезает. Нужно точно метить в контур этого кружка. На большом удалении сложно. Или вообще показывать перекрестие при прикасании мыши свечки.
Ну, это так, вдруг сможете поправить. Спасибо и за то, что уже есть!
Еще есть такая проблема: не получается добавить больше одного ChartIndicatorElement в область, если это делать не из конструктора окна.
Из конструктора все нормально, но если это делать после, то при добавлении второго элемента в одну и ту же Area методом Elements.Add() вылетает ArgumentOutOfRangeException "Index must be within the bounds of the List.\r\nParameter name: index"
Call Stack
at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource) at System.Collections.ObjectModel.Collection
1.Insert(Int32 index, T item) at Abt.Controls.SciChart.DataSeriesSet2.Insert(Int32 index, IDataSeries2 item) at Abt.Controls.SciChart.DataSeriesSet2.Insert(Int32 index, IDataSeries dataSeries) at Abt.Controls.SciChart.SciChartSurface.c914ae6e949e85ff0bd26d406a09606d1(IChartSeriesViewModel cb3791dede44f6f025adf5a17149fa8bf) at A.c3631c672e3fc9e342ac08ff1a63d428e.cacf72b657252e3e73860afb89d70cb9f[c13c28af86f0b14202b9c7ef43b1bd11a](IEnumerable1 c40a30a1bb6416cd164565919fdef15a9, Action1 c885aac61bc9832561b7ff07903c88d5e) at Abt.Controls.SciChart.SciChartSurface.OnChartSeriesCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e) at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e) at System.Collections.ObjectModel.ObservableCollection1.OnCollectionChanged(NotifyCollectionChangedEventArgs e) at System.Collections.ObjectModel.ObservableCollection1.InsertItem(Int32 index, T item) at System.Collections.ObjectModel.Collection1.Add(T item) at StockSharp.Xaml.SciChartPaneViewModel.SciChartIndicator..ctor(SciChartPaneViewModel pane, ChartIndicatorElement fromElem) at StockSharp.Xaml.SciChartPaneViewModel.CreateElement(IChartElement fromElem) at StockSharp.Xaml.SciChartPaneViewModel.AddSeries(IChartElement elem) at Ecng.Common.DelegateHelper.SafeInvoke(Action1 handler, T arg) at Ecng.Collections.BaseCollection2.OnAdded(TItem item) at Ecng.Collections.BaseCollection2.Add(TItem item) at STest.SWindow.RefreshAreas() in c:\Dropbox\QTrading\Test\StockSharp_test\WPFTest\STest\SWindow.xaml.cs:line 545 at STest.SWindow.RunRealTime(Object sender, RoutedEventArgs e) in c:\Dropbox\QTrading\Test\StockSharp_test\WPFTest\STest\SWindow.xaml.cs:line 126 at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs) at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args) at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e) at System.Windows.Controls.Primitives.ButtonBase.OnClick() at System.Windows.Controls.Button.OnClick() at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e) at System.Windows.UIElement.OnMouseLeftButtonUpThunk(Object sender, MouseButtonEventArgs e) at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget) at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target) at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs) at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent) at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e) at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget) at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target) at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs) at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args) at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args) at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted) at System.Windows.Input.InputManager.ProcessStagingArea() at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input) at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport) at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel) at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler) at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg) at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame) at System.Windows.Threading.Dispatcher.Run() at System.Windows.Application.RunDispatcher(Object ignore) at System.Windows.Application.RunInternal(Window window) at System.Windows.Application.Run(Window window) at System.Windows.Application.Run() at STest.App.Main() in c:\Dropbox\QTrading\Test\StockSharp_test\WPFTest\STest\obj\Debug\App.g.cs:line 0 at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart()На новом минимальном проекте не получается ошибку воспроизвести. Все нормально работает. Основной рабочий проект выкладывать не хочу. Будет чуть побольше времени, попробую его вычистить и отловить причину ошибки.