WPF Legend Binded to Graph.

Hi,
I have a ni:Legend object binded to the Plots of my Graph object. Which Property of my Plot should I set from the C# code to see it displayed in the Legend window?
   <ni:Legend Name="MyLegend" ItemsSource="{Binding ElementName=MyGraph, Path=Plots}" />
        <ni:Graph Name="MyGraph" DataSource="{Binding UpdateSourceTrigger=PropertyChanged}">
            <ni:Graph.Plots>
                <ni:Plot/>
            </ni:Graph.Plots>
</ni:Graph>
MyGraph.Plots[0].??? = ???
Solved!
Go to Solution.

The legend uses a WPF ContentPresenter to display the plot Label property. In the case of UI elements, it appears that ContentPresenter defaults to using the ToString representation, instead of the element itself.
To display content like "Something", you will want to assign that content directly to the plot Label property:
    MyGraph.Plots[0].Label = "Something";
If you want to specifically show a WPF Label content control in the legend, you can use the LabelTemplate property:
    <ni:Graph.Plots>
        <ni:Plot>
            <ni:Plot.LabelTemplate>
                <DataTemplate>
                    <Label Content="{Binding}" />
                </DataTemplate>
            </ni:Plot.LabelTemplate>
        </ni:Plot>
    </ni:Graph.Plots>
~ Paul H

Similar Messages

  • How to Generate Event on change in Plot Legend for XY Graph

    Hi,
    I have two XY graphs on the front panel and would like to maintain a common plot legend such that any change in the plot legend affects both graphs.
    Objective: I would like any value change in plot legend to fire an event.
    How do I program that?
    I know of value change event for the graph but am unable to find something specific to the plot legend. Other option is to have the user press a "refresh" button that will fire the event.
    Feel free to share thoughts on other elegant methods to achieve the same objective.
    Thanks,
    Gurdas
    Gurdas Singh
    PhD. Candidate | Civil Engineering | NCSU.edu

    Hi Sarah,
    Looks like you are talking of exactly what I want!
    I have attached a sample VI to try achieve what I want. But it still has some issues which are:
    1) I am unable to configure a Plot Attribute Change Event. I have used a mouse leave event instead. How does one configure a Plot Attribute Change Event?
    2) Is there no single property which will transfer all the settings of plot legend from one graph to plot legend of another graph? In my sample VI, I have to read each property of the master graph and feed it into the slave graph.
    Kindly note I am using LV FDS 7.1 on Win2000
    Thanks,
    Gurdas
    Message Edited by Gurdas on 03-27-2006 11:51 PM
    Gurdas Singh
    PhD. Candidate | Civil Engineering | NCSU.edu
    Attachments:
    Graph_PlotLegend_Event.vi ‏45 KB

  • Scroll bar on legend for xy graph

    Is there a way to create a scroll bar for the legend of an XY graph?  The number of entries in the legend will be changing programmatically so the legend needs to be able to grow dynamically (which I have figured out how to do using property nodes).  Any ideas?
    Cheers
    CLA, CLED, CTD,CPI, LabVIEW Champion
    Platinum Alliance Partner
    Senior Engineer
    Using LV 2013, 2012
    Don't forget Kudos for Good Answers, and Mark a solution if your problem is solved.

    Ultimately I will have 6 xy graphs in my vi, I would like to have a seperate scroll bar for the legend of each graph.  Each graphs legend will both grow and shrink as the program runs and I would like to use the scroll bar to keep the legend from growing off of the screen.  I would like to be able to dislpay the data from the point (6 m/s for example) along with its symbol on the xy graph (red dot for example) in the legend.  If I am umderstanding you correctly I need to bundle the type and color of the plot into a cluster with the data and then link that cluster to the scroll bar, I assume I can read the property node for each data point (setting it to active plot first) for both plot style and color?  Let me know if I am thinking about this correctly or if I have misinterpreted what you are saying.  Thank you very much for your help!
    Cheers!
    CLA, CLED, CTD,CPI, LabVIEW Champion
    Platinum Alliance Partner
    Senior Engineer
    Using LV 2013, 2012
    Don't forget Kudos for Good Answers, and Mark a solution if your problem is solved.

  • Legend for 3d graph

    I want to know how to make a legend for 3d graph.
    I actually posted my question on the following thread but since there havent been any replies, I thought I could just post it here.
    http://forums.ni.com/ni/board/message?board.id=170​&message.id=160715#M160715
    Please click on the link for my question.
    Thanks.

    Hi kmo,
    I'm sure it is possible to get a color map... but I'm affraid I could'nt get to the result you wish I think I'm not far..
    Maybe somebody knows hox to get it from the variant, I am not used to use these "tools": Sory...
    If you don't need a real 3D graph, it might be easier to use an intensity graph.
    When my feet touch the ground each morning the devil thinks "bloody hell... He's up again!"
    Attachments:
    Wafer.vi ‏99 KB

  • No legend title on graph.

    In Anserws I added graph view. All is ok, but legend text is empty.
    In mesures area (Vertical Axis ) there are two bars:
    1. totals for products
    2. totals for regions
    Horizontal axis is date
    When editing graph view, on sample area there are legend text like this:
    sample
    | -- totals for products
    |________ -- totals for regions
    but when I open analyse there is no text 'totals for products' and 'totals for regions' for legend markers
    In graph properties on tab 'Title and legend' for Labels for Legend I choose Font:family=Arial Narrow, color=#000080, style=regular, size 20

    Welcome to the Apple Discussions. Previewing the book as LarryH suggested the dust jacket will look like this:
    Click to view full size
    There you can see the elements of the jacket. If you choose a photo cover with no text you won't get any text on the spine.
    Happy New Year

  • How to change the text in the legend of a graph programmat​ically in labview

    I have many graphs in one plot and want to show the legend the name of the graph (i.e. the filename). How do I change the text in the legend programmatically?

    Create a property node for your graph. Use the property node "Active Plot" to define which plot (or line) you want to rename. Then write the new legend label to the property node "Plot.Name". See attached.
    Tim
    Attachments:
    legend.vi ‏12 KB

  • How to change the legend value in graph OBIEE

    I have 2 columns A and B are measure columns.
    How can I change "A" and "B" in the legend of my vertical bar graph to "LIA" and "ASSET", without changing the A,B name in my subject area.
    Thanks for any help!
    Edited by: user6388889 on Nov 18, 2012 5:46 PM
    Edited by: user6388889 on Nov 18, 2012 5:55 PM

    Hi,
    You can set Axis titles (Vertical Axis & Horizontal Axis) from Graph Properties --> Titles and Labels --> Axis Titles. In case of multiple columns on the access you will be seeing Vertical Axis 1 and Vertical Axis 2.
    Let me know if this helps.
    Regards,
    Jay

  • How to make use of the Legend from XY graph?

    The hardware i am using will create a plot everytime i do a scan. I will upload the it result(plot) to another XY graph. I try to create a multi plot on the XY graph but it seems not working. I am wondering how can i make use of the legend that come with the XY graph to solve my problem.

    Hi,
    You should be able to plot as many XY arrays to the graph as you need. As long as you don't delete the previous plots they should remain there. This will make things much easier than dealing with 2 graphs.
    There is an example at "C:\Program Files\National Instruments\CVI70\samples\userint\graphlegend.cws" that you can look at for an application with multiple plots.
    I hope this helps.
    Regards,
    Juan Carlos

  • How to Create Legend and Label Graph using VBS

    Hi,
    I've scoured the internet before I had to resort to asking my question here. I hope someone can answer my question.
    Using VBS, how can I create a legend of the channels used in the graph and label the axis in the graph? Thanks in advance!
    Solved!
    Go to Solution.

    I've managed to figure out how to create the labels...
    Call GraphObjOpen(D2AxisXObj(1))
    D2AxisXTxt = "@@ChnName(CurrChnNo)@@ [@@ChnDim(CurrChnNo)@@]" ' Defines the x-label
    Call GraphObjClose(D2AxisXObj(1))
     Now to figure out how to create the legend. If anyone can help me, that'd be great.
    ...And now I feel like a downright idiot.
    After more scouring I managed to find what I need
    Call GraphObjOpen("2D-Axis1")
    '------------------- Swith legend on -------------------------------
    D2LEGDRAW =1
    D2LEGTXTTYPE ="Free text" ' "ChannelName" or other keywords
    D2LEGTXTFREE ="My free legend"
    Call GraphObjClose("2D-Axis1")
    'redraw
    Call Picupdate()

  • Automatically labeling plot legend using XY Graphs?

    I want to plot:
    Time Amp
    1       2
    2       4
    3       9
    How do I get the legend to automatically say Amp, instead of Plot 0? I went to property node -> legend and I don't see any option
    that would read the "column" header and label the legend accordingly.
    In my example, the X array (Time) and Y array (Amp) are fed into Bundle which is then fed to the XY Graph input. The X array (1,2,3) and Y array (2,4,9)
    obviously carry no information about their respective column names (Time, Amp). So, the legend must read this information separately, but I don't know
    how to feed this information to the plot legend. 
    Solved!
    Go to Solution.

    You simply need a property node for "plot.name". You have only one plot, so the following is sufficient (of course you would replace the string diagram constant with whatever you read from the column header in the file)
    (If you have several plots, you would do it in a loop, setting the active plot from the iteration terminal, first, then writing the name)
    Since this is an xy graph, I would actually hide the legend and simply label the two axes according to their header. This can be done in a similar way with property nodes. See if you can figure it out.
    (Of course if the labels never change, enter them once manually and they will be saved with the VI. No code needed.)
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    SetPlotName.png ‏3 KB

  • Rotate Plot Legend of XY graph

    Is it possible to rotate the plot legend so the letters of the plot names run from bottom to the top rather than across the operator interface?
    The names for my plots are bigger and I need to show at least four plots at the same time. Putting scales to the right/left/above or below without rotating may cause a shorter XY graph! 
    Any ideas for me?
    Regards
    K Waris
    Solved!
    Go to Solution.

    Hi,
    I don't know if there is a native way to do it, but you can "cheat" to do that:
    You can move the array where the legends are, or even make the array grow into lines instead of column.
    Is the idea ok for you?
    Giuliano Franchetto
    Student at the l'Ecole Nationale Supérieure des Mines de Saint-Etienne, cycle ISMIN (FRANCE)
    Attachments:
    up to dowm legend.vi ‏17 KB

  • Conditional legend in DVT graph

    Hi,
    Is there a way to somehow conditionally show/hide the legend tag of a DVT based on some runtime values?
    <dvt:barGraph id="barGraph1" >
      <dvt:legendArea automaticPlacement="AP_NEVER" rendered="false"/>
    </dvt:barGraph>I checked out the rendered property and it is not EL accessible so obviously this isnt something you can set at runtime.
    But I am just wondering if somebody has done a 'hack' or 'workaround' for this.
    Thanks.
    JDEV 11G PS5

    ...somehow I got confused with the reference documentation http://docs.oracle.com/cd/E23943_01/apirefs.1111/e12418/tagdoc/dvt_legendArea.html
    I just looked at the document and it says it is not EL Accessible. Only a TRUE or FALSE are the valid values so my first thought is that I cannot set this at runtime using managed bean.
    But I noticed that you can still set this value in a managed bean at runtime by clicking the downward icon at JDveloper attributes.
    Not sure if my understanding of the documentation is correct or there is just some problem with the documentation.
    <dvt:legendArea automaticPlacement="AP_NEVER"
                                        rendered="#{pageFlowScope.myBean.isShowLegend}"/>Anyhow my use case is solved.

  • Graph legend and print options

    When building a graph using the graphTable bean, I'd like to place the legend below the graph instead of above. How can this be done?
    Also, the graph plots a number of lines, each of which is rendered in a different color. Is there a way to make the graph lines cross-hatched, or dotted, or something else so that when printed in black and white the user is able to associate the graph line with the legend?

    Hi,
    Take a look at SAP note #1049778. For recent releases, the device type HP4350 should be already available in transaction SPAD n the system.
    Also as per SAP note #1049778, most of the new device types that were developed within the SAP Printer Vendor program (SAP note #1130927) support the new print options.(see SAP note #1103422)
    Regards,
    Aidan

  • Line color/width/style picker as in graph legend

    I am looking for a control similar to what is shown in the legend of a graph and which is used to set the line thickness, color and type. Does anybody know if this graph control is available as a sort of custom control so that I can use it in other parts of my code apart from the legend ?
    Thanks in advance
    Martien

    Martien,
    I understand your frustration and have requested (for years) that NI share (i.e add to palettes) these and many other controls.
    The simplest part of your question to answer is for color selection, just use the Color Box control.
    I have created several custom controls (picture rings) I use for setting other plot/cursor properties.
    The images are transparent for flexibility in use, but you can color the control background if needed for visibility.
    If they are useful, I work for Kudos!   
    Regards,
    James
    Systems Engineering
    LabVIEW 5.0 - 2014
    Attachments:
    Graph Controls.zip ‏17 KB

  • Legend in graph

    Hello ,
    I am unable to get the Legend for my graph in my application in NetWeaver2004s though I have done soem settings via chart designer. Can anyone tell me the settings to be done to get this?
    Thanks & regards,
    Uma.

    Post Author: V361
    CA Forum: General
    is the field you are working with a date or a string.  If a string, you may need to write a formula to convert to a date, then use that formula in your chart.  Hopefully that will fix the legend

Maybe you are looking for

  • Execution of multiple goods movements in one operation

    Hi, Does anyone know of any SAP standard functionality for executing several movememts of materials in one operation? For example, is it possible to execute first mvt type 321 for a material, directly followed by a 301 - in one transaction (without p

  • Can I fullfill from BADI customer fields that appear at item overview ?

    Hi, I can see that in SAPLBBP_SC_UI_ITS 120 (item overview) I have fields CUST1...CUST5.  called in runtime GT_SCR_ITMOVR_I-CUST1.... I have tried to show content using a screen variant, but I haven't achieved. I think that is working but this field

  • Regular expressions using jsp

    Hello Techies, I am having a text area inside a jsp file. When ever the end user gives input it must be submitted to the server. The real problem is when the end user gives special characters and double-quotes in this text area, jsp is preforming in

  • "could not complete the requested operation" when i try to open the program

    "could not complete the requested operation" when i try to open the program what can i do illustrator cc

  • Why can't I share to iDVD?

    I succeeded doing this once before, but now when I choose Share>>iDVD, it does the "Preparing movie" bit for quite a long while and then...nothing. It should open iDVD with the shared movie ready to go, but nothing happens and I can't find that any n