Pre loader

DataPointSelection with Multiple Charts

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

0
1

I am considering applying server-side licensing for my javerScript application.

In the document below, there is a phrase “Our server-side licensing component is written in C++.”
(https://support-dev.scichart.com/index.php?/Knowledgebase/Article/View/17256/42/)

However, there is only asp.net sample code on the provided github.
(https://github.com/ABTSoftware/SciChart.JS.Examples/tree/master/Sandbox/demo-dotnet-server-licensing)

I wonder if there is a sample code implemented in C++ for server-side licensing.

Can you provide c++ sample code?
Also, are there any examples to run on Ubuntu?

Version
4.0.8578
Images
  • Michael Dusoe
    This must be a challenge – the natives are suspiciously quiet :)
  • Andrew Burnett-Thompson
    The natives haven’t had a chance to look yet :) I must be honest, first comment is ‘please try upgrading to the latest version to see if the problem still exists’. After that, if problem still exists, when we get a moment we will look into it.
  • Michael Dusoe
    Andrew – as it happens, I upgraded to 4.2.0.9227 from your NuGet repo just after I submitted this, since I needed the SelectedPointMarker property on the ViewModels, and I saw that it was added roughly a week ago. And yes, I am still seeing this behavior.
  • Michael Dusoe
    Ummm, where did the content of this message go??
  • Andrew Burnett-Thompson
    Glitch in the matrix! It’s back I think. Markiyan on our team is investigating as we speak. Best regards, Andrew
  • You must to post comments
0
0

Hi Michael,

The inbuilt behavior of mouse event sharing is pretty simple. It just sends the same point over to all the modifiers. It doesn’t work in your case, surely – all your surfaces are of different height.

So a possible solution is a custom modifier which does scaling of Y coordinate relative to the original chart’s height. I’ve drafted a simple implementation (which works though) for you as an example:

    public class DataPointSelectionModifierEx : DataPointSelectionModifier
{
    public override void OnModifierMouseDown(ModifierMouseArgs e)
    {
        if (!e.IsMaster)
        {
            e.MousePoint = TransformRelativeToMaster(e.MousePoint, e.Source as IChartModifier);
        }

        base.OnModifierMouseDown(e);
    }

    private Point TransformRelativeToMaster(Point originalPoint, IChartModifier masterModifier)
    {
        var height = masterModifier.YAxis.Height;
        var scale = originalPoint.Y / height;

        var currY = YAxis.Height*scale;

        return new Point(originalPoint.X, currY);
    }

    public override void OnModifierMouseMove(ModifierMouseArgs e)
    {
        if (!e.IsMaster)
        {
            e.MousePoint = TransformRelativeToMaster(e.MousePoint, e.Source as IChartModifier);
        }

        base.OnModifierMouseMove(e);
    }

    public override void OnModifierMouseUp(ModifierMouseArgs e)
    {
        if (!e.IsMaster)
        {
            e.MousePoint = TransformRelativeToMaster(e.MousePoint, e.Source as IChartModifier);
        }

        base.OnModifierMouseUp(e);
    }
}

ModifierMouseArgs.IsMaster indicates whether this modifier belongs to the chart where the mouse event occurred. ModifierMouseArgs.Source gets the “master” modifier from that chart.

Hope this code gives you the idea. Please let us know if you have any complications with it,

Best regards,
Yuriy

  • You must to post comments
0
0

Yuriy,

That solution didn’t quite work, and I think I now understand why… For any given point, each of the 3 modifiers are pointing at the same Metadata object. It doesn’t matter if the “box” of selection is translated correctly, any time a single point is selected in one plot but not selected in another, I create a race condition of sorts, because now there are 3 instances trying to update the same IsSelected property.

However, your response was very insightful. I think I have solved this by using the IsMaster property in a different way. I only allow the mouse events to be handled if the sender is the master! This way, the selected points are always in relation to the box being drawn, and the “selectedness” is propagated to the other 2 plots after a ParentSurface.Invalidate call. The only trouble I ran into was that each Modifier has its own SelectedPointMarkers collection, so I have to clear them all out on Mouse down to ensure no linger points stick around.

Honestly, I think the root of the problem is that I am trying to use a modifier that shouldn’t share mouse events in a ModifierGroup that is set to share mouse events. I haven’t seen any solution to that problem, but this seems to work pretty well.

Anyway, here is the final result:

public class DataPointSelectionModifierEx : DataPointSelectionModifier
{

    public override void OnModifierMouseDown(ModifierMouseArgs e)
    {
        foreach (var pt in SelectedPointMarkers)
        {
            pt.DataPointMetadata.IsSelected = false;
        }

        if (e.IsMaster)
            base.OnModifierMouseDown(e);
    }

    public override void OnModifierMouseMove(ModifierMouseArgs e)
    {
        if (e.IsMaster)
            base.OnModifierMouseMove(e);
    }

    public override void OnModifierMouseUp(ModifierMouseArgs e)
    {
        if (e.IsMaster)
        {
            base.OnModifierMouseUp(e);
        }
        this.ParentSurface.InvalidateElement();
    }

}

Thank you for your help!

Mike.

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies