Pre loader

Display a menu chart (Save, print, Export, add annotation etc)

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

1
0

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.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?

Images
  • You must to post comments
0
0

Hi there,

Unfortunately, we don’t have such an example, but lots of SciChart customers have implemented this behavior for their apps, so I think there shouldn’t be any complications. There is an example how to do this using custom modifier:

        <s:SciChartSurface Name="sciChart"
                           s:ThemeManager.Theme="BlackSteel">
            <s:SciChartSurface.ContextMenu>
                <ContextMenu IsOpen="{Binding IsOpen, Mode=OneWay, ElementName=ContextMenuModifier}">
                    <MenuItem Header="Item1" />
                    <MenuItem Header="Item2" />
                </ContextMenu>
            </s:SciChartSurface.ContextMenu>

...

            <s:SciChartSurface.ChartModifier>
                <s:ModifierGroup>
                    <CreateSimpleChart:ContextMenuModifier x:Name="ContextMenuModifier" ReceiveHandledEvents="True" />
                    <s:CursorModifier ReceiveHandledEvents="True" />
                </s:ModifierGroup>
            </s:SciChartSurface.ChartModifier>

..and modifier’s code:

    public class ContextMenuModifier: ChartModifierBase
    {
        public static readonly DependencyProperty IsOpenProperty =
            DependencyProperty.Register("IsOpen", typeof(bool), typeof(ContextMenuModifier), new PropertyMetadata(false));

        public bool IsOpen
        {
            get { return (bool)GetValue(IsOpenProperty); }
            set { SetValue(IsOpenProperty, value); }
        }

        public override void OnAttached()
        {
            base.OnAttached();

            // Subscribe to listen to ContextMenuOpening event on ParentSurface
            (ParentSurface as SciChartSurface).ContextMenuOpening += OnSurfaceContextMenuOpening;
        }

        private void OnSurfaceContextMenuOpening(object sender, ContextMenuEventArgs e)
        {
            // If !IsOpen, prevent menu from being show by handling the event
            e.Handled = !IsOpen;
        }

        public override void OnModifierMouseDown(ModifierMouseArgs e)
        {
            IsOpen = false;
        }

        public override void OnModifierMouseUp(ModifierMouseArgs e)
        {
            // Open menu if right mouse btn was clicked and Alt btn was pressed
            // IsOpen should be OneWay-bound to SciChartSurface.ContextMenu.IsOpen
            IsOpen = (e.MouseButtons == MouseButtons.Right) && (e.Modifier == MouseModifier.Alt);
        }
    }

I think the above give you an idea how to implement similar behavior. Please, notice, that you need to release Alt button quickly, because the ContextMenu will disappear just after being shown(strange issue).

Also there are a few threads connected to this issue, you can find some useful info or another ideas there: ContextMenu for chart series and Keyboard shortcuts to pan.

Hope this helps!

Best regards,
Yuriy

  • vaquita50
    Thanks Yuriy... This is a great start.... I will try to implement it and if I have any problem I may bother you again. Have a nice weekend!! :)
  • Andrew Burnett-Thompson
    I must say this is good stuff - might make a good example (or tutorial). Thanks Yuriy!
  • You must to post comments
0
0

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.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?

  • Andrew Burnett-Thompson
    I think you need to check the DataContext property of the menu that is shown. Any commands in a ViewModel must be bound to MenuItems, the MenuItem needs to have the DataContext set to the instance of the view model. If it's not, then you can wire it up yourself, e.g. by setting Menu.DataContext = ChartModifierBase.DataContext (assuming, that the data context of your chart modifier base is in fact the correct view model). PS Finally, WPF Snoop (free from codeplex) can help you debug MVVM bindings and show binding errors. Best regards, Andrew
  • 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