Change order of wpf graph plots

I'm trying to solve following issue. Let's say I'm sampling data once per second and showing it on the graph. I want to show history of the data, say last 20 plots using the same color with fading. What I do now:
- create 21 plots, say Plots[0]..Plots[20] 
- at meas 1, set Data[0] = data
- set Plots[0] opacity to 1
- at meas 2, set Data[1] = data
- set Plots[1] opacity to 1, Plots[0] opacity to 0.5
- at meas 3, set Data[2] = data
- set Plots[2] opacity to 1, Plots[1] opacity to 0.6, Plots[0] opacity to 0.3
- at meas 21, set Data[20] = data
- set opacity to 0.1..1
// we're fine as of now, here comes the tricky part
- at meas 22 I need to remove the data of meas 0 (stored at Data[0]) and replace it with the new data
- so I set Data[0] = data
- set Plots[0] opacity to 1 (it's the newest result)
- set other plots opacity 0.1..0.9
// and here is the problem: Plots[0] is now at the bottom of the plot stack and is covered by 20 other plots, thus is barely visible
so I somehow need to move Plots[0] to the top of the stack
I've tried removing Plot and Data of the farthest plot and adding creating plot with the most recent data, but it leads to incorrect indices (Plot.Index grows all the time, but Data array stays the same)
Another option would be to fix plots order and opacity in advance, and change data for all plots all the time. But I assume this would be very slow (think of 20-50 copies of the plot with say 1000 points).
So, any bright ideas here?

Idea 1) Pre-allocate all of the fade plots, use BeginInit/EndInit when updating the Data collection, and always apply the newest data to the last plot. In pseudo-code:
    // initial setup
    for( opacity = 0..1 )
        var renderer = new Renderer( opacity )
        graph.Plots.Add( new Plot { Renderer = renderer } )
    // on data update
    graph.BeginInit()
    for( i = 1..graph.Data.Count )
        graph.Data[i - 1] = graph.Data[i] /* shift old data down */
    graph.Data[20] = /* assign new data to the last plot */
    graph.EndInit()
Idea 2) If you just want the historic data visible in the graph (i.e. you do not need to query or interact with the old data through the graph), and if your range is stable, then you could have one plot in the graph and use a PhosphorColorRamp to get the visual fade effect. In pseudo-code:
    // initial setup
    var brush = new SolidColorBrush( C )
    Graph.SetPhosphorMode( brush, Immediate )
    graph.Plots.Add( new Plot { Renderer = new Renderer( brush ) } )
    graph.RenderMode = Raster
    graph.PhosphorColorRamp = new FadeRamp { Color = C, Duration = 20, DurationKind = Frames }
    // on data update
    graph.Data[0] = /* assign new data to first plot */
(Note that the phosphor effect is one of the areas being updated, so the syntax will be changing in the next release of Measurement Studio.)
~ Paul H

Similar Messages

  • 3D graph plot properties - cannot be changed

    Hi all,
    I still cannot change the plot properties of the 3D graph.  I open the Plot Properties tab up and it gets stuck on the first page.
    This means that I cannot release any VIs which use the 3D graph - a big problem.
    Has anyone else experience this?  What do you suggest to fix it.
    Thanks,
    Battler.

    I have experienced exactly the same behavior (can not change 3D graph plot properties) with 3D plots (scatter and surface) in LabVIEW 2011.  The 3D plot properties page works correctly at first but then fails to switch pages after larger data sets have been loaded to the graph.  For example, my scatter graph contains 13 plots, each with 320 points of data.  Once the page "gets stuck" it is stuck for all 3D graphs until the offending graph is deleted and re-created.  To reproduce this issue create at least one 3D plot with a large number of plots in it.
    On a related note, if there was a programmatic method for deleting plots from a 3D graph then it's possible that this issue could be worked around.

  • Changing Graph Plot Legend

    I have no problem changing a normal graphs plot legend with a property node, but I'm trying to display three different sets of data on one graph.  I tried doing it using a plot reference with the Plot Legend and using Caption Text.  They should be settable when the VI is running, but the way I was trying to do it I got a reference error (1055 Reference Invalid).  Setting either the Plot Legend or Caption Text would be acceptable if I could just figure it out.
    I'm trying to display 32 spectrums, but only use 8 graphs and have the name of the particular channel change.  Doing this without doing an FFT the channel name gets brought into the graph, but when I use the Power Spectrum VI I don't have the Spectrum Info wired into anything.  So, I'm bringing my original channel name array over and trying to do an iteration to pick the correct plot reference and channel name.
    I've extracted only the part of my code for this question, so hopefully it is easy to look at what I'm doing.
    The first VI and SubVI are functional.  The second SubVI is where I was attempting to change the Caption Text.  I've tried other things too, but I just wanted to show one way I was attempting to do it.
    Solved!
    Go to Solution.
    Attachments:
    Part of Analyzer - Displaying Graph Legend.vi ‏1432 KB
    Calc Channel Indices 1_35.vi ‏27 KB

    I don't have the SV add on so I can't check out your main program. I looked at your sub vi and you're doing more code than you need to. Take a look at my example, I've put your 8 graphs into a cluster then used an array of references along with arrays for your chanel indecies. Maybe it can give you some ideas for your program.
    Attachments:
    Calc Channel Indices 1_35 mod.vi ‏766 KB

  • WPF graph children z-order

    I have a canvas added to a WPF graph's children in XAML to drawing various text blocks and lines. Later in code I add RangeCursors. The RangeCursors paint on top of the canvas, but I'd like the canvas on top. Is there a way to control this? I've tried both adding the RangeCursors at the end of the children collection and inserting at position 0, but the result is the same (RangeCursors on top).
    Solved!
    Go to Solution.

    Set the ZIndex of the canvas to a value above the default of zero:
        <ni:Graph.Children>
            <Canvas Panel.ZIndex="1" ... />
            <ni:RangeCursor ... />
        </ni:Graph.Children>
    ~ Paul H

  • Z-order on XY-graphs

    OK quick question....
    In LV 6.1, is there any way to influence the Z-order of the
    plots?  I want to have a basic plot (it's a multiple-peak
    spectrum) in the background with the area between the plot and zero
    filled.  I then want to be able to superimpose the individual
    peaks on this basic plot.  At the moment, if I place the basic
    plot at index 0, it overwrites all others, and the individual peaks
    become hidden (this is bad).  I've adapted to this and simply
    reversed my order of plots (this is good).
    The problem comes whan I have varying amounts of plots on my
    graphic.  Setting and re-allocating the visual plot properties
    each time I select or deselect a plot is really slowing down my
    code.  What I really need to be able to do is simply set the
    Z-order of the plots so that I can effectively send the basic plot to
    the background, irrespective of it's order in the plot list.  I
    also don't want to limit the number of plots as I don't like that
    approach out of principle.  I like my code being able to take
    whatever is thrown at it.
    Here are a couple of pics illustrating my problem....
    Thanks in advance
    Shane.
    Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
    Attachments:
    This is good.png ‏7 KB
    This is bad.png ‏6 KB

    Christian and Lynn,
    Thanks for the replies.  I think I'll have to go the route
    suggested by Christian since I kind of thought that changing the
    Z-order of the graph rendering wouldn't be possible.
    Lynn,  This is exactly what I'm doing at the moment.  I'm
    basically reversing the array so that the last three plots are always
    the same, and then setting the plot properties accordingly.  This
    is working, but it's a real pain and it's also awkward to
    maintain.  Speed isn't critical, but it takes around 500 msec to
    allocate 17 plots.  This is already noticeable in an otherwise
    zippy UI.
    What I'll most likely do is the following:
    When the spectrum is loaded, allocate plots for ALL data sets (This
    part I won't limit in the number of plots, thus allowing for huge
    amounts of data - no artificial limit).  I still have to do some
    plot processing and setting display properties of the graph, but this
    will be done on loading the data, so it's not TOO bad.
    Then afterwards, as the individual plots are selected and deselected,
    I'll simply hide the respective plots.  This makes at least the
    handling of appearing and disappearing plots much easier.  This
    means that all plots will be permanently visible on the Legend, but
    that's not such a problem really.  Only cosmetically.  I need
    to think about whether the legend is even neccessary.  I can't
    limit the number of entries visible on the legend, because the most
    important are at the end.  I have thought of creating a dummy XY
    graph off-screen and using the legend from that instead of the legend
    from the actual XY graph, but that's not really making things simpler.
    EIther way, thanks for the help guys,
    Does anyone know how things look in later versions of LV?  How
    about the all-new super duper turbo-charged LabVIEW 8.0? (this post
    will seem so silly in 5 years time when LabVIEW X is around).  Any
    option to control the Z-order ot the graph rendering?
    Shane.
    Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)

  • Different custom colors for a WPF line plot

    Dear Sir,
    I am trying to create a WPF graph with different colors for different points of time , example  Black 0-10,red 11-20, green 21-30...
    I saw the nifty video and download the range masking cursor but got stuck. 
    Thank you
    George MAsiello

    Here's a quick mockup of the custom renderer version (sorry I did not have time to translate it to VB myself):
        public class CustomRenderer : PlotRenderer {
            private static readonly DataRequirements _dataRequirements = new DataRequirements(
                DataCulling.PreserveLines, DataDecimation.CoLinear,
                new DataDimension( DataDimensionSource.IndexData, DataDimensionScale.IndependentScale ),
                new DataDimension( DataDimensionSource.SampleData, DataDimensionScale.DependentScale ) );
            // The color ranges we want to show on the plot.
            private readonly Tuple<Color, double>[] _colorRanges = new[] {
                Tuple.Create( Colors.Black, 10.0 ),
                Tuple.Create( Colors.Red, 20.0 ),
                Tuple.Create( Colors.Green, 30.0 ),
            private readonly RenderTargetOptions[] _rangeOptions;
            public CustomRenderer( ) {
                // Create render options for each range color.
                _rangeOptions = _colorRanges.Select( colorRange => new RenderTargetOptions( this,
                    RenderTargetOption.CreateValue( RenderTargetOptionsProperty.Stroke, new SolidColorBrush( colorRange.Item1 ) ),
                    RenderTargetOption.CreateValue( RenderTargetOptionsProperty.StrokeThickness, 1.0 ) ) )
                .ToArray( );
            public override SupportedRenderModes SupportedRenderModes {
                get { return SupportedRenderModes.VectorAndRaster; }
            public override DataRequirements GetDataRequirements( ) {
                return _dataRequirements;
            protected override Freezable CreateInstanceCore( ) {
                return new CustomRenderer( );
            protected override void RenderLegendCore( LegendRenderArgs renderArgs ) { }
            protected override void RenderGraphCore( PlotRenderArgs renderArgs ) {
                // Get the time axis for the renderer.
                Plot plot = (Plot)renderArgs.Plot;
                var timeAxis = plot.GraphParent.GetAxis( plot, Orientation.Horizontal );
                var dataMapper = (IDataMapper<double>)timeAxis.GetDataMapper( plot.GraphParent );
                int startIndex = 0;
                var xData = renderArgs.RelativeData[0];
                var yData = renderArgs.RelativeData[1];
                var renderTarget = renderArgs.RenderTarget;
                for( int i = 0; i < _colorRanges.Length - 1; ++i ) {
                    // Draw all data below the current range with the associated color.
                    int endIndex = startIndex;
                    double range = _colorRanges[i].Item2;
                    double offset = dataMapper.Map( range );
                    while( endIndex < xData.Size && xData[endIndex] <= offset )
                        ++endIndex;
                    RenderSegment( startIndex, endIndex, xData, yData, renderTarget, _rangeOptions[i] );
                    startIndex = endIndex;
                // Draw all remaining data with the last color range.
                RenderSegment( startIndex, xData.Size, xData, yData, renderTarget, _rangeOptions.Last( ) );
            private static void RenderSegment( int startIndex, int endIndex, Buffer<double> xData, Buffer<double> yData, IRenderTarget renderTarget, RenderTargetOptions options ) {
                int length = endIndex - startIndex;
                if( length <= 0 )
                    return;
                // Join current range with previous.
                if( startIndex > 0 ) {
                    --startIndex;
                    ++length;
                using( Buffer<double> xSegment = xData.Slice( startIndex, length ) )
                using( Buffer<double> ySegment = yData.Slice( startIndex, length ) )
                    renderTarget.DrawLines( options, xSegment, ySegment );
    ~ Paul H

  • Multiplot waveform graph plots are different colors when set to be the same with a property node.

    The graphs were working yesterday. I made a few changes to another part of the block diagram and now the graphs do not plot all of the plots the same color. I am using a for loop with a property node with the elements active plot connected to the iteration terminal, and plot color to a color box. My for loop increments programmaticaly from another part of the code to create plots as it runs. I have replaced the graphs with new ones and they will work sometimes.
    I am using Win2k and LV 7.1
    Thanks,
    Brett

    Hi bh3560,
    Have you tried chaging the color by right clicking on the line in the plot legend.  There is an option to change the color of the plot.
    Brian K.

  • Bode plot instrument reading differs when compared to grapher plot

    Good Day,
    Need some help to understand why the bode plot instrument plot (clicking the instrument to see plot) is different from the grapher plot when run in "simulate >>> analysis >>> AC analysis >>> vertical scale (db) >>> simulate.
    Problem happens if the AC source AC analysis magnitude is changed from 1(default) to another value. i.e 6.
    Please help advise, it seems the bode plotter is only considering the default AC analysis default magnitude value of 1?.
    Appreciate comment on this. Thank you
    The circuit being simulated is AC source connected to an RLC circuit and Vo is accross C. L and C assume some small series resistances.

    Hi educ,
    In the AC Analysis I set the stop frequency to 100 KHz which is the stop frequency of the Bode Plotter instrument. When I ran the analysis after doing this and compared it to the bode plotter, it was a nearly identical output. Try to configure the start and stop frequency to match in the AC Analysis and in the Bode Plotter and you should see much better results.
    Regards,
    Tayyab R,
    National Instruments.

  • Change order of key figure is not working in Web report output (using WAD)

    Hi,
    We are using BI 7.0, release 701 and level 008. We are facing problem in WAD (web report output). When ever we do 'Select filter' for key figures and 'change the order' of key figures, it does not get reflected in new order. Though drag and drop of key figures is working.
    Though same change order is working fine in Bex Analyser.
    Kindly suggest some inputs.
    Thanks.

    Hi,
    On Which Service Pack are you on?WAD has this feature of re arranging the keyfigures in BI 7.0 for SPS 14...
    Regards,
    Bhagyarekha.

  • Is it possible to change the scale of graph in webi ?

    Hi All,
    How to change the scale of graph in the web intelligence report.
    Thanks in advance,
    Ravi

    1. Set intervals on Y-axis values of the Webi report Charts from the Webi Chart Properties
    2. Set the Interval of 500 with Y-axis value range 0 2000,such that the value should look like,0,500,1000,1500,2000   
    Reproducing the Issue
    1. Create a Webi report from e-fashion with objects Year and Sales Revenue.
    2. Run the Webi report>Turn to Column Chart.
    3. Go to Chart properties>Y Axis>Scale
    4.Here there are 2 options.
    5. Min value, Max value however the major unit option is not available like one we have in Crystal Reports and Deski
    Environment Details:
    1. BOXIR2, BOXI3.0
    Cause
    This is a limitation in Webi report.
    Resolution
    Enhancement_Request ADAPT01202508 for this issue has been raised however there is no specific timeline as of now defined about which major release this feature will be included in.
    Regards,
    Sarbhjeet Kaur

  • Change order of line items in a financial document

    Hello,
    Is it possible to define the order of the line items in a financial  document?
    For example, I have always a discount line with a discount account in the first place and after this line, the customer line, and the bank account and I need to have the customer line in the fist place, is it possible to customize this order?Or is this standard?
    Thank you very much!!

    Hi,
    You can change orders in FInancial Document. Just open the document from Menu select Settings-> Layout--> Current.
    change the position numbers as desired.
    Regards,
    JA

  • Changing Order of Songs in Album-iTunes 12

    Like the title says, how do I change the order of songs in a album? Before you could use get info and sort by track number.
    Thanks

    Hey Lando25,
    I understand that you want to change order of songs that are playing in iTunes. This functionality should still be available to you, as confirmed in this article:
    iTunes 12 for Mac: Edit song and CD information
    https://support.apple.com/kb/PH19618
    You may need to simply scroll in the information field in order to find the fields that you wish to edit. Thanks for coming to the Apple Support Communities!
    Cheers,
    Braden

  • Iam using a table in numbers to plot daily graph lines. If I fill a cell with a text box  at say zero it plots the graph. I can't actually set the cell value until the actual day but the graph plots it at zero when I don't want it to plot anything. Is tho

    I am using a table in Numbers to plot daily graph lines. Mood swings of how I am on the day, i"m a depressive.
    If I fill a cell with a step box at say zero it plots the graph. I can't actually set the cell value until the actual day but the graph plots it at zero when I don't want it to plot anything. Is there a work around. so thatbgraph only plots on the day?

    The answer is (sort of) in your subject, but edited out of the problem statement in the body of your message.
    When you use a stepper or a slider, the value in the cell is always numeric, and is always placed on the chart if that cell is included in the range graphed by the chart.
    But if you use a pop-up menu cell, you can specify numeric or text values in the list of choices for in the menu. Numeric values will be shown on the chart. Text values will not.
    For the example, the values list for the pop-up menu was:
    5
    3
    1
    Choose
    -1
    -3
    -5
    The first pop-up was set to display Choose, then the cell was filled down the rest of the column. Any text value (including a single space, if you want the cell to appear blank) may be used instead of Choose.
    For charts with negative Y values, the X axis will not automatically appear at Y=0. If your value set will include negative values, I would suggest setting the Y axis maximum and minimum to the maximum and minimum values on your menu list, rather than letting Numbers decide what range to include on the chart. Place a line shape across the chart at the zero level, and choose to NOT show the X axis.
    Regards,
    Barry

  • HT201317 change order of photos in photo stream album

    How do I change order of photos posted in photo stream album?

    Send a feature request to Apple via
    http://www.apple.com/feedback/iphoto.html
    and
    http://www.apple.com/feedback/icloud.html
    OT

  • Help with fuzzy search (doesn't work if change order of certain 2 letters)

    Hi,
    need some help with fuzzy search. It's pretty simple - we use fuzzy search on varchar2 columns that contain first name and last_name. The problem is that i don't really understand why it can't find name in some cases.
    Say i want to search for 'Taekpaul'. Then
    where CONTAINS(first_name,'fuzzy(TAEKPAUL)',1) > 0 - works
    where CONTAINS(first_name,'fuzzy(TAEKPALU)',1) > 0 - works (changed order of the 2 last letters)
    where CONTAINS(first_name,'fuzzy(TEAKPAUL)',1) > 0 - doesn't work, finds 'Tejpaul' that is completely unrelated (changed 2nd, 3rd order)
    How can i make it find 'Taekpaul' even if i search for TEAKPAUL? Is it related to index? Like Text index should be created with some different parameters?
    Thanks!
    Edited by: Maitreya2 on Mar 3, 2010 2:08 PM

    Thanks, adding '!' worked :)
    Do you know where i can read more about '!' and other special characters? I think i didn't see anything like that here: http://download.oracle.com/docs/cd/B14117_01/text.101/b10730/cqoper.htm#BABBJGFJ
    I also started using JARO_WINKLER_SIMILARITY function that is actually better i think for what i do. But it's very buggy - sometimes Oracle crashes and kills connection when you try to use it.
    Ahha, it's here: http://download.oracle.com/docs/cd/B19306_01/text.102/b14218/cqspcl.htm
    So, ! is soundex. Whatever it means..
    Edited by: Maitreya2 on Mar 5, 2010 12:14 PM

Maybe you are looking for

  • Intermittent network performance with WRE54G on Vista, and no Xbox 360 connectivity

    I bought a WRE54G this week to help with some network dead spots in my home after moving house. So far I've only had no real success - configuration seemed to take a while to work through (by the time I got the WPA PSK worked out) but now I at least

  • ICal on Mac will not sync changes made in Mobileme or my phone via Mobileme

    I cannot get iCal to accept any calendar changes from Mobile to my laptop. Only events created, deleted or edited on my laptop with iCal are syncing correctly. I've tried creating/deleting from my iphone. The events show up on my mobileme calendar on

  • Printing to shared printer on Tiger 10.4

    We have an older iMac that has a printer connected via USB (Officejet 6200). It is shared via printer sharing and runs Mac OS X 10.4. The iMac is connected to a Snow (dual Ethernet) Airport base station. I could see it and print to it with 10.5 from

  • Editing artist in itunes for my iphone

    I'm cleaning up all my music in my iphone. I can edit the artst, song, album etc, in itunes when my iphone is plugged in, but it then doesn't appear corrected on my iphone once i'm done. I have synced it after I edit, but still my music on my iphone

  • Hard drive seems to be renamed?

    So, I was doing some Safari browsing for the better part of 2 hrs (sucked into Wikipedia for a while). When I exited, I noticed my hard drive icon was moved to the other sideof my screen and now has the name "415263*_". This seems very scary. Should