WPF chart - select a horizontal range

Hello

I use the chart WPF of MS2015, I want to allow the selection of a range of horizontal (without zoom) so that the user can see the selected range.

1. How do I allow to select the horizontal range in the chart?

2. the data graphic is ChartCollectionAnalogWaveform , how can I access the data of the selected only (I want to show statistical data)?

What you describe sounds like a perfect fit for the RangeCursor . For example:

XAML

    

        

            

        

    

Code

    foreach( IPlot plot in graph.AllPlots ) {

        var values = rangeCursor.RetrieveValues( plot );

        using( var xValues = values[0] )

        using( var yValues = (Buffer)values[1] ) {

            double average = yValues.Average( );

            string example = string.Format( "Plot {0} average over [{1:0}]: {2:0.##}", plot.Index, rangeCursor.ActualHorizontalRange, average );

            // ...

        }

    }

Tags: NI Software

Similar Questions

  • Secondary axis on the WPF chart

    Hello

    I'm tracing a secondary value axis on my WPF chart. I have a graphic linked to a table of AnalogWaveform of objects that I change during execution. This table can be different sizes depending on the user's selection, however assume that there are two types of data to the chart.

    I would like to match a data type of my main axis and the other guy to my axis is secondary. For example, I have four AnalogWaveform opposes the plot, two of whom are in Hz (primary) and the other two in Volts (secondary).

    According to the documentation, I need an additional of element under my definition of . What I have is:

             

























    This adds a second value axis to the left of my main axis. What I need is for this axis which will be located to the right of my chart and somehow to draw each AnalogWaveform on the right y-axis.

    I build my locations in the code as follows:


    _graph. Plots.Clear ();

    RawData is my AnalogWaveform[], built in advance based on a response from the server
    foreach (AnalogWaveform waveform in RawData)
    {
    If (waveform! = null)
    {
    field = new plot (waveform. ChannelName);
    parcel of land. DataContext = waveform;

    plots. Add (Plot); plots is a simple list
    }
    }

    _graph. Plots.AddRange (studs); Add locations to graph

    _legend. ItemsSource = plots. Add locations to the legend

    Any help would be appreciated on how to do it.

    Thanks in advance.

    To position your second Y axis across the graph, set the Location property on the axis of Far .

    To associate a plot to a default axis, set the VerticalScale property on the ground in the axis value is appropriate.

  • Select the page range

    Hello

    How select the page range and perform our duties with the special pages?

    Selva

    The example script below focuses on the dialog box that is used to get the scope of the user pages. Run the script and parse the code. You should be able to apply it to your needs. I hope this helps.

    try {}

    assume that the document is opened

    docRef var = app.documents.item (0);

    maxPages var = docRef.pages.count ();

    provide the variable to contain the user's response

    var userResponse = dialogWChoices ("Name of dialogue', while 'label here", maxPages);

    Enter the function call that treats all pages

    If (userResponse [0] == 0) {}

    Class (docRef, 0, maxPages);

    } else {}

    var minPageRef = userResponse [1] - 1;

    var maxPageRef = userResponse [2] - 1;

    Class (docRef, minPageRef, maxPageRef);

    }

    } catch (e) {}

    alert (e);

    }

    Alert ("Input by the user" + userResponse [0] + "" + userResponse [1] + "" + userResponse [2]);

    function to treat the page range

    function class (docRef, minPageRef, maxPageRef) {}

    var thispage, thisFrame, docOffset;

    for (var i = minPageRef; I<= maxpageref;="" i++)="">

    Thispage = docRef.pages.item (i);

    docOffset = (thisPage.documentOffset) + 1;

    thisFrame = thisPage.textFrames.add ({geometricBounds: [36, 72, 100, 300]});

    thisFrame.contents = 'Page of Hello' + docOffset

    }

    }

    function gets the page range, or 'all' of the user

    function dialogWChoices (dlgName, cancelIt, dLabel maxPages) {}

    var userCancelled = false;

    var origValue = app.scriptPreferences.userInteractionLevel;

    Make sure that the levels of user interaction will allow a dialogue

    app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERACT_WITH_ALL;

    create the dialog box

    var dlgRef = app.dialogs.add ({name: dlgName, cancel: cancelIt, label: dLabel});

    Add a column

    var dlgColumn1 = dlgRef.dialogColumns.add ();

    var dlgColumn2 = dlgRef.dialogColumns.add ();

    var dlgColumn3 = dlgRef.dialogColumns.add ();

    Add widgets for the first column

    dlgColumn1.staticTexts.add ({staticLabel: "PageRange :"});})

    Add widgets to the second column

    radioGroup var = dlgColumn2.radiobuttonGroups.add ();

    radioGroup.radiobuttonControls.add ({staticLabel: "All", checkedState:true});})

    radioGroup.radiobuttonControls.add ({staticLabel: "Range", checkedState:true});})

    Add widgets in the third column; put the reference in a variable

    var emptyRow = dlgColumn3.dialogRows.add ();

    emptyRow.staticTexts.add ({staticLabel: ""});

    var inputRow = dlgColumn3.dialogRows.add ();

    var firstField = inputRow.integerEditboxes.add ({minWidth:36, minimumValue:1, maximumValue:maxPages});})

    inputRow.staticTexts.add ({staticLabel: "thru '" "});

    var secondField = inputRow.integerEditboxes.add ({minWidth:36, minimumValue:1, maximumValue:maxPages});})

    display the dialog box and capture the result

    If (dlgRef.show () == true) {}

    var firstVal = 0;

    var secondVal = 0;

    var selButton = radioGroup.selectedButton;

    If (selButton == 1) {}

    var firstVal = firstField.editValue;

    var secondVal = secondField.editValue;

    }

    } else {}

    userCancelled = true;

    }

    dlgRef.destroy ();

    app.scriptPreferences.userInteractionLevel = origValue;

    If {(userCancelled)

    throw ("user canceled");

    }

    destroying the dialog box; script gets here if the user cancels

    return [selButton, firstVal, secondVal];

    }

  • Draw a line connecting two points in the WPF chart

    I'm trying to understand the best way to draw a line between two existing points on my graph in WPF.  At first, I thought I had it works fine; I just added another parcel to my graph then given exactly two points for rendering.  But I quickly noticed that the app has become surprisingly slow and CPU was quite high (adding other plots does not affect the use of the CPU as long as they have a complete set of points (?)).  He wants me if I looked at using the DataToScreen method on the chart but I can't know what the parameters are.  The second parameter is simply an IList that tells me a lot.  This seems to be the method I want to use for the coordinates of a point on the graph screen.

    No one knows what the second parameter is supposed to be for the DataToScreen method?  Everything I tried throws an Exception of Argument.

    Thank you
    Dan

    DataToScreenwill return a screen coordinate in the plot area of a chart of the value of the raw data horizontal and vertical in the given list. The parameter value is a IList for compatibility with other methods of graphical query such as FindNearestValue , return IList values containing raw data.

    A concrete example, say you had a graphical configuration with a wide horizontal axis ranging from 0 to 100 and a vertical axis double precision ranging from 10 to 20:


            
                
                
            
        

    To get the screen coordinates of the value at the center of the two axes, you can call:

    graph.DataToScreen(plot, new object[] { 50, 15.0 })

    Note that the raw data values corresponding to the type of axes (horizontal AxisInt32 returns the integer 50 and vertical AxisDouble Gets the value 15.0 ).

    You also mentioned a performance issue where "adding other plots does not affect the CPU so that they have a complete set of points". I did a simple test app that adds an array of two points of a chart on each key (for example graph.Data.Add(new[] { new Point(x1, y1), new Point(x2, y2) }); ), but could not reproduce the problem you saw. Could you share the code, you use to draw the connection line?

  • Hide the first and the last Division in the WPF chart axis

    I want to hide the default marker of the first and the last major division in an axis of a chart of WPF. I tried to extend RangeDivisionsMode and define my own class object to the MajorDivisions.Mode property on the axis. But even when I returns a list empty in RangeDivisionsMode.GetDivisions(...), the first and the last marker is drawn.

    Thanks in advance, Jonas

    The minimum and maximum labels are transmitted separately when displaying a scale (even if technical RangeDivisionsMode custom can be used for the minor divisions).

    There is no direct configuration option to hide extreme labels, but you can achieve this effect by initializing the LabelPresenter property on MajorDivisions by a custom implementation:

    class CustomFormatter : GeneralValueFormatter {

            protected override UIElement VisualizeCore( TData value, ValuePresenterArgs args, UIElement existingVisual ) {

                UIElement element = base.VisualizeCore( value, args, existingVisual );

    var axis = (Axis)args.Context;

                Range range = axis.Range;

                var comparer = range.Comparer;

                bool isExtreme =

                       comparer.Compare( range.Minimum, value ) == 0

                    || comparer.Compare( range.Maximum, value ) == 0;

                element.Opacity = isExtreme ? 0.0 : 1.0;

    return element;

            }

        }

  • ObjectDisposedException with ChartCollection a WPF chart

    When I start the following program (WPF. net4.0, NI.common (13.0.40.190), OR.) Controls.Graph (13.0.40.242)) I get the following in the debugger error message

    ObjectDisposedException was not handled

    The data store has been modified.
    Name of the object: ' Buffer'.

    Source : NI.Common

    I have a device class that generates some milli seconds of random data. I inform my main class through events and then pass the values via the parameter.

    XAML I bind the data graphic to a ChartCollection as follows: (the bold lines are the most relevant)

    The error occurs only when the time of my data provider crosses a certain threshold.

    500 ms - all right

    200ms - works ok, but hangs at the exception, when I change the size of the window

    20 ms - always ok

    10ms - crashes instantly with the exception

    {

    Data = new Data();

    public event PropertyChangedEventHandler PropertyChanged;
    protected virtual void OnPropertyChanged (string propertyName)
    {
    var Manager = PropertyChanged;
    If (Manager! = null) Manager (this, new PropertyChangedEventArgs;
    }

    Private ChartCollection _chartCollection1 = new ChartCollection(1000);

    private ChartCollection = new ChartCollection_chartCollection2 (1000);
    private ChartCollection = new ChartCollection_chartCollection3 (1000);
    private ChartCollection = new ChartCollection_chartCollection4 (1000);

    public ChartCollection Chart1
    {
    get {return _chartCollection1 ;}
    set
    {
    If (_chartCollection1.Equals (value))
    {
    return;
    }

    _chartCollection1 = value;
    OnPropertyChanged ("Chart1");
    }
    }

    public ChartCollection Graph2
    {
    get {return _chartCollection2 ;}
    set
    {
    If (_chartCollection2.Equals (value))
    {
    return;
    }

    _chartCollection2 = value;
    OnPropertyChanged ("Graph2");
    }
    }
    public ChartCollection Graph3
    {
    get {return _chartCollection3 ;}
    set
    {
    If (_chartCollection3.Equals (value))
    {
    return;
    }

    _chartCollection3 = value;
    OnPropertyChanged ("Graph3");
    }
    }
    public ChartCollection Graph4
    {
    get {return _chartCollection4 ;}
    set
    {
    If (_chartCollection4.Equals (value))
    {
    return;
    }

    _chartCollection4 = value;
    OnPropertyChanged ("Graph4");
    }
    }

    public Window1()
    {
    InitializeComponent();

    GraphView graphView = new GraphView();
    ContentControlGraph.Content = graphView;
    ContentControlGraph.DataContext = this;

    data.dataReadyEvent += dataEventHandler;
    Closing += MainWindow_Closing;
    }

    Sub MainWindow_Closing (ByVal sender As Object, e CancelEventArgs)
    {
    data. Stop();
    Environment.Exit (0);
    }

    ' private void ButtonBase_OnClick (object sender, RoutedEventArgs e)
    {
    data. Start();
    }

    private int j;
    ' private void dataEventHandler (object sender, EventArgs e)
    {
    j ++ ;
    If (j == 1)
    {
    Graph1.Append ((double[]) sender);
    }
    Else if (j == 2)
    {
    Graph2.Append ((double[]) sender);
    }
    Else if (j == 3)
    {
    Graph3.Append ((double[]) sender);
    }
    on the other
    {
    Graph4.Append ((double[]) sender);


    j = 0;
    }
    }
    }

    The exception occurs in the DLL, so I can not catch it either.

    I think that you run in the multi-threading problem described here: could not get Graph.DataSource to work in WPF, I (thread problem?).

    In short, your chart add calls must be marshaled to the user interface thread.

  • Select a data range

    Hello world

    I would like to know How to select a range of data (for example on a graph of force/time during a jump landing (parable), of one certain value to another) to save it to a special file? I tried the module "separated" or "cut out" but I don't think that they will be useful when you do not know where the SPECIFIC value you are looking for will appear...

    It is also possible to Dasylab for know the Steering coefficient of this type of curve (quite linear...)?

    Thank you!

    Maybe...

    Select the values in a block (values of y) to the given positions (values of y).

    Calculate the differences and calculating the quotient.

  • Chart how many plots with wpf chart

    This is probably a very basic question, but I can't understand how the chart more than a set of data with the chart WPF in VS2010.  There is a DataSource property on the chart, but I don't see the same on each class of land.  I can't find any documentation on the source property of the chart data.  Can I pass an array of doubles and he plots very well but now I need to draw two sets of data.  Can anyone help?

    The DataSource property is documented in the how: map and graphic subject and on the GraphBase class (which is the type that defines the property). However, it seems that these issues do not directly address your question multiple plot; I put in a request to improve this.

    To answer your question, if you use DataSource to pass an array of double values in a plot, you can use a collection to pass data to multiple locations (for example a double[][] , a List , or a ObservableCollection ).

    Otherwise, you could use the Data collection to provide each parcel with data; for example:

    graph.Data[0] = /* double[] for plot 0 */;

        graph.Data[1] = /* double[] for plot 1 */;

    ~ Paul

  • Plots of non-visible WPF chart

    I am using measurement graphic studio in my WPF application. Firstly to my chart, the plots on it becomes sometimes invisible, but the graph becomes visible if I click on the limits of the axis or change the title of the axis. It happen with one is not specific in my request, and I'm not sure why it's happening. I will be grateful if someone could help with this.

    Thank you.


  • Can build, but can not run a simple WPF chart

    Hello

    I just got my NI Measurnments Studio package and I try to add a graphic to my WPF c# application but I have questions that I have not seen in the examples of the trial.  Before you buy this package, I changed one of the examples of the trial to draw my own data and it worked beautifuly.  Now I tried to do the same thing in my own project and it builds without error but I get InitializeComponent() exception when I try to run it:

    "The call of the constructor on type"NationalInstruments.Controls.Graph"that matches the constraints of binding specified threw an exception."

    That's what I have:

    • Added to my project references (VS 2013)

    C:\Program Files (x 86) \National Instruments\MeasurementStudioVS2012\DotNET\Assemblies\Current\NationalInstruments.Common.dll

    C:\Program Files (x 86) \National Instruments\MeasurementStudioVS2012\DotNET\Assemblies\Current\NationalInstruments.Controls.dll

    C:\Program Files (x 86) \National Instruments\MeasurementStudioVS2012\DotNET\Assemblies\Current\NationalInstruments.Controls.Graphs.dll

    • Added to this, notably in XAML

    "" xmlns: or = 'http://schemas.ni.com/controls/2009/xaml/presentation '

    • And added this chart control to XAML



    <>area of Label = "Channel 1" x: Name = "Plot1" / >
    <>area of Label = "Channel 2" x: Name = "Plot2" / >


    Nothing else behind it, so I should at least power run and see a graph empty, right?

    Please advice.

    Thank you!

    I got it work.  Basically, it was licening known issue in 2013 VS.  I had the .licx added manually in my project file.  Here is the email that I received or who has been very useful:

    "I noticed that you use Visual Studio with Measurement Studio 2013 2013. Currently measure Studio 2013 is only officially supported by Visual Studio 2012, however, many of our clients were able to make it work with Visual Studio 2013 Measurement Studio 2013. We have an article for the knowledge base that walks by working with Measurement Studio 2013 in Visual Studio 2013. It might be good to make sure you followed every step through this article: http://digital.ni.com/public.nsf/allkb/C51E3B38578FAD2786257C070069F386

    It looks like you are using the correct assemblies, and we were able to test the XAML for our side. It works beautifully, so it doesn't seem like there's something is happening with the code. Another thing, we can try is to clean the Solution and regenerate the Solution in Measurement Studio. It will be a good step to make sure that no old persistent files. »

    Thank you

  • New in MapPoint. Can help you with the selection of a range of data?

    Hello

    I just open MapPoint 2013 as import data, select a radius from a given location and export data.  That's all I need of MapPoint to manage but can't seem to find a small tutorial on how to on this subject.

    I tried flying by the seat of my pants, so to speak and have selected a range of 70 minutes, but the output file shows only 96 files when I know that many more within a radius of driving I've selected.  Bugs appear to be associated with zip codes.  For example, in the Excel file there are no addresses (records) but only zip codes and a list indicating the number of organizations within each zip.  I want real organizations in a range of one hour.

    You can ask in the following forum because they are more likely to have relevant experts:

    Highway, streets and Trips, MapPoint .

  • Several results of the Select statement horizontally

    Hello

    DB Version: Oracle 11.1.2.1.0

    OS: OEL5

    I try to print the results of several SELECT horizontally using SQL statements, but not able to reach my goal.

    Multiple SQLs:

    SELECT 'DB Version', version db_version FROM v$instance
    UNION ALL
    select 'Oracle Client', length(addr)*4 || '-bits' word_length from v$process where ROWNUM =1
    UNION ALL
    select 'Database Edition', trim(substr(banner,20,19)) from v$version where rownum<2
    UNION ALL
    SELECT 'Single Instance or RAC', CASE COUNT(1) WHEN 1 THEN 'Single Instance' ELSE 'RAC' END is_single_instance FROM gv$instance
    UNION ALL
    SELECT 'No of CPUS', to_char(value) FROM v$osstat WHERE stat_name='NUM_CPUS'
    UNION ALL
    SELECT 'No of CPU Cores', to_char(value) FROM v$osstat  WHERE stat_name='NUM_CPU_CORES'
    UNION ALL
    SELECT 'No of CPU Sockets', to_char(value) FROM v$osstat  WHERE stat_name='NUM_CPU_SOCKETS'
    UNION ALL
    SELECT 'Physical Memory (GB)', to_char(ROUND((value/1024/1024/1024),3)) FROM v$osstat  WHERE stat_name='PHYSICAL_MEMORY_BYTES'
    /
    
    

    Result:

    'DBVERSION'            DB_VERSION
    ---------------------- ----------------------------------------------------------------------------
    DB Version             11.2.0.1.0
    Oracle Client          64-bits
    Database Edition       Enterprise Edition
    Single Instance or RAC Single Instance
    No of CPUS             4
    No of CPU Cores        2
    No of CPU Sockets      1
    Physical Memory (GB)   3.864
    
    
    8 rows selected.
    
    

    Expected result:

    DB VERSION  ORACLE CLIENT   DATABASE EDITION         SINGLE INSTANCE OR RAC     NO OF CPUS  NO OF CPU CORES  NO OF CPU SOCKETS  PHYSICAL MEMORY (GB)
    ----------- --------------- ------------------------ -------------------------- ----------- ---------------- ------------------ ---------------------
    11.2.0.1.0  64-bits         Enterprise Edition       Single Instance            4           2                1                  3.84
    
    

    Any help would be greatly appreciated.

    Val

    SELECT "DB Version."

    "Oracle Client."

    "Database Edition."

    "Single instance or RAC.

    "None of the processors."

    "No CPU Cores.

    "No CPU Sockets."

    "Physical memory (GB).

    OF (choose the version "DB Version" of v$ instance where rownum)<>

    (choose the length (addr) * 4 | bits "Oracle Client" from v$ process where ROWNUM = 1).

    (select trim (substr (banner, 20: 19)) "Database Edition" version $ v where rownum)<>

    (select CASE COUNT (1) WHEN 1 THEN 'Single Instance' ELSE 'RAC' END 'Single Instance or RAC' SGS $ instance).

    (SELECT to_char (value) 'Number of processors' v$ stat_name WHERE osstat = 'NUM_CPUS'),

    (SELECT to_char (value) "Number of CPU cores" v $ stat_name WHERE osstat = 'NUM_CPU_CORES'),

    (SELECT to_char (value) 'number of CPU Sockets"v$ stat_name WHERE osstat = 'NUM_CPU_SOCKETS'),

    (SELECT to_char (ROUND ((value/1024/1024/1024), 3)) 'physical memory (GB)' v $ stat_name WHERE osstat = "PHYSICAL_MEMORY_BYTES")

    /

    DB Version Oracle customer Database Edition Single Instance No. No. processors CPU Cores No. CPU Sockets physical memory (GB)
    ----------------- --------------- ------------------- --------------- ---------- --------------- ----------------- --------------------
    11.2.0.3.0 64-bit Enterprise Edition Single Instance 4 4 and 1 7.991

    SQL >

    SY.

  • A summary report of comment with possibility to select script page ranges

    Hi all

    I use Adobe Acrobat X Pro on Windows 7.

    I am a newbie to JavaScript, but were using the following script (in fact found this great forum!) to create a report of summary PDF comment.

    It works fine, but I would like to be able to include a line of code to select only specific page ranges (1-40) as I work with a PDF file with 700 pages and you want to create a report summary of the specific chapters. I tried to insert a code for printing specific pages, but when I used Ctrl + Enter to run the script it would bring just to the top of the print window.


    Any help would be appreciated.

    Thank you!

    this.syncAnnotScan ();

    var a = this. getAnnots ({nSortBy:ANSB_Page});

    If (a) {}

    var = new Rep Report();

    Rep.size = 1.8;

    Rep.Color = color.blue;

    rep.writeText ("summary of comments to" + this.documentFileName);

    Rep.Color = color.black;

    rep.writeText("");

    Rep.size = 1.2;

    rep.writeText ("Total of" + a.length + "comments in this file");

    rep.writeText("");

    rep.writeText("");

    Rep.Indent (20);

    var msg = '\200 page %s of %s of % s ';

    for (var i = 0; i <.) Length; i ++) {}

    rep.writeText("");

    rep.indent (20);

    rep.writeText (a [i] .silence);

    Rep.Outdent (20);

    }

    var docReport = rep.open ("commentSummary.pdf");

    docReport.info.Title = "summary of comments for" + this.documentFileName;

    }

    You will need to add more terms or to adjust this one, for example, to reach the beach you specified above (note the page numbers in the code are zero-based):

    If (a [i] .page<80 ||="" a.page="">117) continue;

  • By selecting a color range

    I had problems with this several times. When I go to a specific color and move to the color setting to select only he, color range picks up around the colors.
    I have several adjustment layers on the top-do not know if it could have an impact on it.

    I'll show you what I mean:

    Screen Shot 2015-09-20 at 12.12.59 PM.png

    I want the white color broken image. So, I use the pipette, go to "sampled colors" in the color range, but then I see that the selection is actually - it:

    Screen Shot 2015-09-20 at 12.14.37 PM.png

    See how its red/blues pick up and no stopping white section on the shoulder of the man? Why is this?

    Please and thank you.

    Can you show a capture with the layers showing screen Panel and open the dialog open beach of color? You have fixed blur to? for one color that has little variation, it must be set to low.

    It is with a low setting:

    It is set high:

  • Select the color range crashing Photoshop CC 2015

    Just updated to Photoshop CC 2105. Photoshop crashes every time that I have use the shift for sample colors in the select color range. Using Windows 7. Someone knows how to solve?

    Thanks, helped your description. I got it down. He established a 0 tolerance it does. When I set the tolerance to 1 he didn't do. While it is a bug, I had just set the tolerance to 1 if you really want to use 0 move it back after you have made the selection. I never use 0, I always feel like a few feathers. If I want something that lasts, I would use the magic wand tool. I'll have to see about this statement.

Maybe you are looking for