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

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy. We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!

Please note: SciChart team will only answer questions from customers with active support subscriptions. Expired support questions will be ignored. If your support status shows incorrectly, contact us and we will be glad to help.

0
0

Hi guys,

Can you help me with the following problems that I have implementing this?

  1. there is any way to export the chart data to CSV and XSL?
  2. How can I make this the following two functionalities work:
    a)
    b)
    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);
    }

As you can see both use the the mouse right button so, when a) is executed, b) does not work…
I was thinking that maybe if I could execute a) when double right click it may fix it… but I am not sure how to do it. Any ideas how to fix this?

Thanks very much…

  • You must to post comments
0
0

Hello there,

Right click can be implemented by overriding OnModifierDoubleClick. Let me know if that helps!

Andrew

  • vaquita50
    Hi Andrew.. Thanks very much for your answer.... I am trying to implement to override the OnModifierDoubleClick... I need this functionality to happen when Right-double click... so as you can see in the following code... I do a check if the button is right but it does not work... it only works with left-double click.... any ideas? is it a bug? in the .xaml:
    <custom:NotifyZoomExtentsModifier x:Name="NotifyZoomExtentsModifier"/>
    
    My custom Class:
    public class NotifyZoomExtentsModifier : ZoomExtentsModifier
        {
            public event EventHandler<EventArgs> OnUserZoomExtents;
    
            public override void OnModifierDoubleClick(ModifierMouseArgs e)
            {
                if (e.MouseButtons == MouseButtons.Right)
                {
                    // Before ZoomExtents operation
                    base.OnModifierDoubleClick(e);
                    // After ZoomExtents operation
    
                    RaiseOnUserZoomExtents();
                }
            }
    
            private void RaiseOnUserZoomExtents()
            {
                var handler = OnUserZoomExtents;
                if (handler != null)
                {
                    handler(this, EventArgs.Empty);
                }
            }
        }
    
    And please can you tell me if here is any way to export the chart data to CSV and XSL? Thanks :)
  • Andrew
    Hmmm ... not sure. I will have to do some further investigation. In the meantime - can you not implement some click counting in combination with a timer to simulate right-double-click? Regarding export to CSV - no, no feature as such. What would you like to export? The Data, or the axis / properties? If you give me some more info I'll create a feature request in our backlog. Thanks! Andrew
  • vaquita50
    Hi Andrew.... I have implemented the the functionality to simulate the right-double click that you suggested but it is not working :( any other ideas? and about to export the data, I have found a solution:
    private void ExportAscsvCommandExec(List<ChartDataModel> chartDataModels)
            {
                try
                {
                    var chartData = chartDataModels.FirstOrDefault().ChartData;
                    if (chartData == null)
                        return;
    
                    var dialog = new SaveFileDialog
                    {
                        DefaultExt = "csv",
                        AddExtension = true,
                        Filter = "Csv Files|*.csv",
                        InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
                    };
                    if (dialog.ShowDialog() != true) return;
    
                    var output = new StreamWriter(dialog.FileName);
    
                    output.WriteLine(DisplayText.time + "," + DisplayText.test);
                    foreach (var item in chartData)
                    {
                        output.WriteLine(item.Key + "," + item.Value);
                    }
    
                    output.Close();
                }
                catch (Exception ex)
                {
                    MessageBoxService.ShowError(ex.Message);
                }
            }
    
    
    So basically, the data that populates the charts is coming for me in the following form:
    Dictionary<DateTime, double>
    where the Key (DateTime values) are my X and the Value(double) are my Y. Anyway, I think It will be really useful that Scichart had the ability to export the data in an easy way. :) Thanks :)
  • Andrew
    Hello, not working in what sense? Do you receive a Right Click event at all? If not try setting the ReceiveHandledEvents=True flag on the modifier. Our modifiers mark events as handled to prevent them travelling down to subsequent modifiers in the group. Setting this flag will ensure they get the event. If you receive a right click event its just a matter of counting the clicks between a suitable time (e.g. 250-500ms) and you have your right-double-click! Thanks for the feature request re: export data, I will add it to the backlog! ;-) Best regards, Andrew
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.