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

2 votes
936 views

Hi, I am currently working with the DataPointSelectionModifier with StackedColumnRenderableSeriesViewModel series. I currently am able to get the data point with the correct values whenever I click on a column but it seems that I am not able to change the selection fill of the column.

All I can seem able to do is changing the color of the whole series, but that is not what I am looking for.

Best Regards.

0 votes
2k views

Hello,

I am using StackedColumnRenderableSeries and I need annotations like in Histogram example:

enter image description here

    private void Window_Loaded(object sender, RoutedEventArgs e)
    {
        var brushes = new Brush[] { Brushes.Red, Brushes.Green, Brushes.Blue, Brushes.Cyan, Brushes.Gray };
        var groups = new string[] { "Group 1", "Group 2", "Group 3" };
        var datas = new Dictionary<int, double[]>()
        {
            {1, new double[]{5.0, 4.0, 3.0, 2.0, 1.0}},
            {2, new double[]{1.0, 2.0, 3.0, 2.0, 1.0}},
            {3, new double[]{1.0, 2.0, 3.0, 4.0, 5.0}}
        };
        var data = new XyDataSeries<int, double>[brushes.Length];
        for (int i = 0; i < brushes.Length; i++)
        {
            data[i] = new XyDataSeries<int, double>();
        }
        foreach (var pair in datas)
        {
            for (int i = 0; i < pair.Value.Length; i++)
            {
                data[i].Append(pair.Key, pair.Value[i]);
            }
        }

        for (int i = 0; i < brushes.Length; i++)
        {
            var renderableSeries = new StackedColumnRenderableSeries()
            {
                Fill = brushes[i],
                DataSeries = data[i],
                StackedGroupId = brushes[i].ToString(),
            };
            sciChart.RenderableSeries.Add(renderableSeries);
        }
    }

How I can add annotation for each stacked grouped column? I attached the example with my Side-By-Side chart.

Ideally, I expected the annotations to be like in attached image.

1 vote
2k views

Hello,

I have the need to be able to select a single column or a set of columns from either a FastColumnRenderableSeries or a StackedColumnRenderableSeries.

Is there an out-of-the-box way to do this?

If negative, could you provide me some guidance as to what I could do?

Thank you.

Kind regards,
Sebastian

0 votes
2k views

Hello,

I am using two StackedColumnRenderableSeries in my chart, but following the example “Stacked Column Side by Side”.

I am trying to add a text annotation that will contain the actual value of each column at the top of the column (very similarly as it is shown on the example “Histogram”).

The problem is that I’m able to get the data point position, not each individual columns centered position.

I have inherited from StackedColumnRenderableSeries, and there’s a method called GetColumnCenterTopAndBottom but the center value is not as expected.

In the attached image I show the positions I want to get (marked in blue).

Is there a way to get these values?

Thank you.
Sebastian

1 vote
3k views

Hi,

I need create a columnChart with multiple Column value.

If I create a datapoint with 0 in Y value I have a flat red line

{
    XyDataSeries<DateTime, double> Serie = new XyDataSeries<DateTime, double>();
    foreach (var point in Ohlcvs)
        Serie.Append(point.THE_DATE, (point.O < point.C) ? point.V : 0);
    var ser = new StackedColumnRenderableSeries
    {
        DataSeries = Serie,
        StackedGroupId = "VolumeId",
        FillBrush = ColorCode.StockUp,
        SeriesColor = ColorCode.StockUp.Color,
        DataPointWidth = 0.8
    };
    ChartVolume.RenderableSeries.Add(ser);
}
{
    XyDataSeries<DateTime, double> Serie = new XyDataSeries<DateTime, double>();
    foreach (var point in Ohlcvs)
        Serie.Append(point.THE_DATE, (point.O > point.C) ? point.V : 0);
    var ser = new StackedColumnRenderableSeries
    {
        DataSeries = Serie,
        StackedGroupId = "VolumeId",
        FillBrush = ColorCode.StockDown,
        SeriesColor = ColorCode.StockDown.Color,
        DataPointWidth = 0.8
    };
    ChartVolume.RenderableSeries.Add(ser);
}

when StackedColumnRenderableSeries is used with different number of datapoint in the each serie I have this bug

    {
        XyDataSeries<DateTime, double> Serie = new XyDataSeries<DateTime, double>();
        foreach (var point in Ohlcvs.Where(o=>o.O<o.C))
            Serie.Append(point.THE_DATE, point.V );
        var ser = new StackedColumnRenderableSeries
        {
            DataSeries = Serie,
            StackedGroupId = "VolumeId",
            FillBrush = ColorCode.StockUp,
            SeriesColor = ColorCode.StockUp.Color,
            DataPointWidth = 0.8
        };
        ChartVolume.RenderableSeries.Add(ser);
    }
    {
        XyDataSeries<DateTime, double> Serie = new XyDataSeries<DateTime, double>();
        foreach (var point in Ohlcvs.Where(o => o.O > o.C))
            Serie.Append(point.THE_DATE, point.V);
        var ser = new StackedColumnRenderableSeries
        {
            DataSeries = Serie,
            StackedGroupId = "VolumeId",
            FillBrush = ColorCode.StockDown,
            SeriesColor = ColorCode.StockDown.Color,
            DataPointWidth = 0.8
        };
        ChartVolume.RenderableSeries.Add(ser);
    }

In the real case , there are 8 series .
They can beings presented on the same point X or not .

Thanks

  • Sylvain60 asked 4 years ago
  • last active 4 years ago
0 votes
0 answers
4k views

Hi,

I am displaying some charts on the screen (4 per screen). When I double click one chart, it opens in another, modal window.
I have the below problem with the tooltip modifier and the rollover modifier (one is enabled at a time, tried with both, need the fix at least for the tooltip modifier)

When I close the window, the following happens, to the chart that was double clicked:

1- If the chart is a simple column chart, the tooltip modifier does not work as soon as the maximized window is closed. Nothing happens when I move the mouse. I found a simple workaround, which is to zoom in/out even very little, and the modifier works back. Here I’m forcing it by code:

private void ChrtSurface_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            //Get the chart from the sender tag
            var surface = (SciChartSurface)sender;
            var chart = (SciChart)surface.Tag;

            //The chart is already executed, so no need  do that again. Start the single view form
            var form = new SingleChartView(new SingleChartViewModel(chart, this._viewModel.SelectedModule.Id));
            form.ShowDialog();

            ZoomChartToExtents(chart);
        }

public void ZoomChartToExtents(SciChart chart)
        {
            var scichartSurface = lstCharts.FindVisualChildren<SciChartSurface>().FirstOrDefault(x => x.Tag == chart);
            Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.ApplicationIdle, new Action<SciChartSurface>(ZoomExtents), scichartSurface);

        }

        public void ZoomExtents(SciChartSurface chart)
        {
            chart.ZoomExtents();
            chart.ChartModifier.OnModifierMouseUp(new ModifierMouseArgs() { MouseButtons = MouseButtons.Right });
        }

2- If the chart is a stacked chart, I get a null reference exception. Here’s the exception:

“An exception of type ‘System.NullReferenceException’ occurred in Abt.Controls.SciChart.Wpf.dll but was not handled in user code

Additional information: Object reference not set to an instance of an object.”

And the stack trace (if zoom extents is not called):

at Abt.Controls.SciChart.Visuals.RenderableSeries.StackedColumnRenderableSeries.HitTestInternal(Point rawPoint, Double hitTestRadius, Boolean interpolate)
at Abt.Controls.SciChart.Visuals.RenderableSeries.BaseRenderableSeries.HitTest(Point rawPoint, Double hitTestRadius, Boolean interpolate)
at Abt.Controls.SciChart.Visuals.RenderableSeries.BaseColumnRenderableSeries.HitTest(Point rawPoint, Double hitTestRadius, Boolean interpolate)
at Abt.Controls.SciChart.Visuals.RenderableSeries.BaseRenderableSeries.HitTest(Point rawPoint, Boolean interpolate)
at Abt.Controls.SciChart.ChartModifiers.InspectSeriesModifierBase. . (IRenderableSeries )
at Abt.Controls.SciChart.ChartModifiers.InspectSeriesModifierBase. .MoveNext()
at Abt.Controls.SciChart.ChartModifiers.TooltipModifier.YB(Point C, Point& D)
at Abt.Controls.SciChart.ChartModifiers.TooltipModifier.HandleMasterMouseEvent(Point mousePoint)
at Abt.Controls.SciChart.ChartModifiers.InspectSeriesModifierBase.YB(Point C)
at Abt.Controls.SciChart.ChartModifiers.InspectSeriesModifierBase.HandleMouseEvent(ModifierMouseArgs e)
at Abt.Controls.SciChart.ChartModifiers.InspectSeriesModifierBase.OnModifierMouseMove(ModifierMouseArgs e)
at Abt.Controls.SciChart.ChartModifiers.ModifierGroup.AC(IChartModifier C, ModifierEventArgsBase D)
at Abt.Controls.SciChart.ChartModifiers.ModifierGroup.YB(Action2 C, ModifierEventArgsBase D)
at Abt.Controls.SciChart.ChartModifiers.ModifierGroup.OnModifierMouseMove(ModifierMouseArgs e)
at Abt.Controls.SciChart.Utility.Mouse.MouseManager. (ModifierMouseArgs , IReceiveMouseEvents , Boolean )
at Abt.Controls.SciChart.Utility.Mouse.MouseManager.
. . (IReceiveMouseEvents )
at Abt.Controls.SciChart.Common.Extensions.EnumerableExtensions. [ ](IEnumerable
1 , Action`1 )
at Abt.Controls.SciChart.Utility.Mouse.MouseManager.
. (Object , MouseEventArgs )
at A. . (MouseEventArgs )
at A. . (Object , MouseEventArgs )
at System.Windows.Input.MouseEventArgs.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 ISF.Application.App.Main() in c:\Users\Charbel\Documents\Projects\ISF\ISFSolution\ISF.Application\obj\Debug\App.g.cs:line 0
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel)
at System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly()
at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext)
at System.Activator.CreateInstance(ActivationContext activationContext)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
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()

If zoom extends is called, I get the following stack trace:

at Abt.Controls.SciChart.Visuals.RenderableSeries.StackedColumnRenderableSeries.GetXRange()
at Abt.Controls.SciChart.Visuals.Axes.AxisBase.YB()
at Abt.Controls.SciChart.Visuals.Axes.AxisBase.GetMaximumRange()
at Abt.Controls.SciChart.Visuals.SciChartSurface.YB(TimeSpan C)
at Abt.Controls.SciChart.Visuals.SciChartSurface.YB(TimeSpan C)
at Abt.Controls.SciChart.Visuals.SciChartSurface.ZoomExtents()
at ISF.Application.Dashboard.Windows.Dashboard.ZoomExtents(SciChartSurface chart) in c:\Users\Charbel\Documents\Projects\ISF\ISFSolution\ISF.Application\Dashboard\Windows\Dashboard.xaml.cs:line 54

More info in case it helps:

I tried using the SimpleRolloverModifier code from http://support.scichart.com/index.php?/Knowledgebase/Article/View/17235/32/custom-chartmodifiers—part-1—creating-a-custom-rollover-modifier

And found that when the problem happens, the hit test either detects nothing or causes a null reference.

The problem ONLY happens when I open and close the modal window. If I don’t do that all works fine.

Thanks
Charbel

  • cabdo asked 4 years ago
  • last active 4 years ago
1 vote
4k views

Hi All,

This is a very similar issue to the following forum entry – the only difference being that I’m using a StackedColumnRenderableSeries rather than a FastColumnRenderableSeries :

https://www.scichart.com/questions/question/issue-with-logarithmicnumericaxis-and-fastcolumnrenderableseries

I gathered from the above that there may be a problem with small data values but I’ve been using a set of test points ranging in value from 10 to 50 (although ultimately i’ll be using values in the e-5 range) and have tried setting the ZeroLineY value as suggested but to no avail. Following Nazar’s comments in the other forum entry, it seems there is something to do with calculating a value from the column width and I’m wondering if the side-by-side nature of the StackedColumnRenderableSeries has something to do with the problem.

I put a single series on the chart and it displays as expected – all I then do is change the axis type in the XAMl as follows:

            <!-- WORKING but obviously doesn't display in log format -->
        <s:SciChartSurface.YAxis>
            <s:NumericAxis AutoRange="Always" AxisAlignment="Left" AxisTitle="Pressure" ScientificNotation="E" TextFormatting="#.#E+0" CursorTextFormatting="#.#E+0" GrowBy="0.0, 0.1"/>
        </s:SciChartSurface.YAxis> 

        <!-- NOT WORKING creating blank chart devoid of even the gridlines -->
        <s:SciChartSurface.YAxis>
            <s:LogarithmicNumericAxis AutoRange="Always" AxisAlignment="Left" AxisTitle="Pressure" TextFormatting="#.#E+0" CursorTextFormatting="#.#E+0" GrowBy="0.0, 0.1"/>
        </s:SciChartSurface.YAxis>

I’m on version 3.4.0.6319 – I’ve just realized that one of my last posts was fixed by a later release and I should have checked that first. oh well, I’m here now!!!

Any ideas anyone?
/Stu

1 vote
4k views

I’m creating the series for a stacked column chart like so:

string[] categories = new string[] { "0-10", ">10-20", ">20-30", ">30-40", ">40-50", ">50-60", ">60-70" };
                    foreach (string category in categories)
                    {
                        i++;
                        Color _color = GetRandomColor(i);

                        var tempSeries = new XyDataSeries<double, double> { SeriesName = category };
                        FillDataSeries(ref tempSeries, category);

                        if (tempSeries == null) continue;

                        var tempRenderSeries = new StackedColumnRenderableSeries
                        {
                            DataSeries = tempSeries,
                            FillBrush = new SolidColorBrush(_color),
                            StackedGroupId = "currents"
                        };

                        // Add the new RenderableSeries
                        sciChart.RenderableSeries.Add(tempRenderSeries);
                    }

                    sciChart.ZoomExtents();

                    i++;                    
                }

The FillDataSeries method will populate the series from a .net DataSet object. The X axis contains numeric values that represent grouped direction categories and the Y axis contains numeric values representing the percentage of records for each category. The series are speed ranges.

However, my chart results in gaps in the columns.

chart example

I’m not sure what causes this? Do the Series need to be zero filled for categories that have no records?

  • wawr asked 4 years ago
  • last active 4 years ago
Showing 8 results
This template supports the sidebar's widgets. Add one or use Full Width layout.