Inactive plot annotation

Hi all,
I have multi-plot graph with annotation that displays the value. There is an option to sort the plot and make only one plot active at time.
Although the inactive plot is invisible, annotation still reads from inactive plot when I click there with mouse.
How do I completely disable certain plot so annotation only recognizes the one that's visible and active plot?
Thanks again.

Is this the method that you have used to make an active plot?
http://digital.ni.com/public.nsf/websearch/8C2071579CF38F0686256BE9005EE0B2?OpenDocument
Try disabling the individual annotations, as seen in the shipping example "Programmatically Annotate a Graph.vi."  In LabVIEW, go to Help>>Find Examples.  When example finder pops up, go to Fundamentals>>Graphs and Charts>>Programmatically Annotate a Graph.

Similar Messages

  • The caption on an annotation is off the plot area. Even if I cahnge the x and y scaling I still can't see the annotation caption. How can I change it so that I can see it?

    The caption on an annotation is off the plot area. Even if I cahnge the x and y scaling I still can't see the annotation caption. How can I change it so that I can see it?

    Try calling SetCoordinates on the annotation's Caption property. This method lets you explicitly set the x and y coordinates of the caption.
    - Elton

  • DigitalGraph Annotation at different axis-Y level although the value is same

    Hi,
    I have plot a graph with annotation and I found it labeling the axis-Y at the different level, with the same value.
    Please look at the screenshot I attached. I have attached the Vi too, simply run it will get the result as preview in screenshot. 
    So, 
    Any idea to fix this ? 
    and I need to know, 
    How the annotation actually label the axis-Y level ? (sometimes label at  '1', sometimes at '0', a reason behind it that cause this inconsistently ? a fix setting as written in cluster should have all the label at the same level, but why it behave up and down..) 
     Please help .. Thanks in advance..
    Attachments:
    forum.JPG ‏103 KB
    waveformlabel.vi ‏28 KB

    Hi,
    Thanks for sending your VI with your question. I've tried running it and it appears to run fine with the digital input waveform you have specified. Do you have any input data that you know causes an error that you could send to me? I have attached a screenshot of what happens when I run the VI, so let me know if that looks more like what you are trying to achieve.
    Also, the reason for the annotation switching between a 1 and a 0 along the various lines is because it is an indication of whether the digital signal on that line is high or low at that point, rather than a label on the y-axis itself. It shows that on, for example, line 4, the signal begins low, hence the 0 on the axis, before switching to high, hence the 1 on the axis. I'd be very grateful if you could let me know if this answers your question and don't hesitate to ask if you need anything else clarifying.
    Regards
    Jeremy T
    Technical Marketing Engineer
    National Instruments UK & Ireland
    Attachments:
    Digi waveform.JPG ‏146 KB

  • How can I update single plot in multi plot xy graph?

    Hi all,
    I'm working on an HMI "front" for a larger acquisition/analysis system, that includes continuous performance monitoring of a turbine. The results of the measurements are stored arrays of contour lines, that represents turbine efficiency and guide vane openings. This analysis is all performed in the background. In the HMI, the performance data is loaded from file when the specific "report" is requested, and is plotted in an XY graph. I would like to indicate the current operation point of the machine by using a plot that is a single point. Thus, that point's position among the contour lines indicates the current performance of the turbine. This point is updated once every second, while the performance data remains the same for considerable amounts of time between recalculations (days to weeks). 
    Is there any way of updating the value of a single plot in a multiple plot XY Graph without having to redraw all the plots?
    I've tried using the "Active Plot" property, which doesn't work. 
    My current solution is to keep all the data as input to the executing while loop and replace a subset of the plot array, but that of course requires the entire rewrite every time the operation point plot is updated.
    Best regards,
    Jarle Ekanger, MSc, CLD
    Flow Design Bureau AS
    Solved!
    Go to Solution.

    You cannot redraw a single plot. If you want to update a single plot, you need to retain all plots in a shift regsiter and replace the data of the desired plot. However, your problem seems much simpler than that. To show a single point on a nearly static plot you have several options.
    You can use a cursor that is controlled programmatically (the style can be a point, don't allow drag).
    You can use annotations.
    You can use the "plot images" feature that allows you to use image commands to draw anything on top of a graph.
    None of these ideas require a redraw of any data.
    I think the cursor idea is probably the easiest and most appropriate. Just use a property node with the following properties:
    active cursor
    cursor position x
    cursor position y
    LabVIEW Champion . Do more with less code and in less time .

  • How can I change  oval shape applet to (plot)

    Hi this is not my code so, the orignal code is freeware to www.neuralsemantics.com and is Copyright 1989 by Rich Gopstein and Harris Corporation.
    The site allows permission to play with the code or ammend it.
    how could I modify the applet to display (plot) several cycles of the audio signal instead of the elliptical shape. The amplitude and period of the waveform should change in accordance with the moving sliders
    Here is the code from www.neuralsemantics.com /applets/jazz.html
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    public class JazzMachine extends Applet
                 implements Runnable, AdjustmentListener, MouseListener {
      // program name
      final static String TITLE = "The jazz machine";
      // Line separator char
      final static String LSEP = System.getProperty("line.separator");
      // Value range
      final static int MIN_FREQ = 1;   // min value for barFreq
      final static int MAX_FREQ = 200; // max value for barFreq
      final static int MIN_AMPL = 0;   // min value for barVolume
      final static int MAX_AMPL = 100; // max value for barVolume
      // Sun's mu-law audio rate = 8KHz
      private double rate = 8000d;      
      private boolean audioOn = false;     // state of audio switch (on/off)
      private boolean changed = true;      // change flag
      private int freqValue = 1;           // def value of frequency scrollbar
      private int amplValue = 70;          // def value of volume scrollbar
      private int amplMultiplier = 100;    // volume multiplier coeff
      private int frequency, amplitude;    // the requested values
      private int soundFrequency;          // the actual output frequency
      // the mu-law encoded sound samples
      private byte[] mu;
      // the audio stream
      private java.io.InputStream soundStream;
      // graphic components
      private Scrollbar barVolume, barFreq;
      private Label labelValueFreq;
      private Canvas canvas;   
      // flag for frequency value display
      private boolean showFreq = true;
      // width and height of canvas area
      private int cw, ch;
      // offscreen Image and Graphics objects
      private Image img;
      private Graphics graph;
      // dimensions of the graphic ball
      private int ovalX, ovalY, ovalW, ovalH;
      // color of the graphic ball
      private Color ovalColor;
      // default font size
      private int fontSize = 12;
      // hyperlink objects
      private Panel linkPanel;
      private Label labelNS;
      private Color inactiveLinkColor = Color.yellow;
      private Color activeLinkColor = Color.white;
      private Font inactiveLinkFont = new Font("Dialog", Font.PLAIN, fontSize);
      private Font activeLinkFont = new Font("Dialog", Font.ITALIC, fontSize);
      // standard font for the labels
      private Font ctrlFont;
      // standard foreground color for the labels
      private Color fgColor = Color.white;
      // standard background color for the control area
      private Color ctrlColor = Color.darkGray;
      // standard background color for the graphic ball area
      private Color bgColor = Color.black;
      // start value for the time counter
      private long startTime;
      // maximum life time for an unchanged sound (10 seconds)
      private long fixedTime = 10000;
      // animation thread
      Thread runner;
    //                             Constructors
      public JazzMachine() {
    //                                Methods
      public void init() {
        // read applet <PARAM> tags
        setAppletParams();
        // font for the labels
        ctrlFont = new Font("Dialog", Font.PLAIN, fontSize);
        // convert scrollbar values to real values (see below for details)
        amplitude = (MAX_AMPL - amplValue) * amplMultiplier;
        frequency = (int)Math.pow(1.2d, (double)(freqValue + 250) / 10.0);
        setLayout(new BorderLayout());
        setBackground(ctrlColor);
        setForeground(fgColor);
        Label labelVolume = new Label(" Volume ");
        labelVolume.setForeground(fgColor);
        labelVolume.setAlignment(Label.CENTER);
        labelVolume.setFont(ctrlFont);
        barVolume = new Scrollbar(Scrollbar.VERTICAL, amplValue, 1,
                         MIN_AMPL, MAX_AMPL + 1);
        barVolume.addAdjustmentListener(this);
        // assign fixed size to the scrollbar
        Panel pVolume = new Panel();
        pVolume.setLayout(null);
        pVolume.add(barVolume);
        barVolume.setSize(16, 90);
        pVolume.setSize(16, 90);
        Label labelFreq = new Label("Frequency");
        labelFreq.setForeground(fgColor);
        labelFreq.setAlignment(Label.RIGHT);
        labelFreq.setFont(ctrlFont);
        barFreq = new Scrollbar(Scrollbar.HORIZONTAL, freqValue, 1,
                      MIN_FREQ, MAX_FREQ);
        barFreq.addAdjustmentListener(this);
        // assign fixed size to the scrollbar
        Panel pFreq = new Panel();
        pFreq.setLayout(null);
        pFreq.add(barFreq);
        barFreq.setSize(140, 18);
        pFreq.setSize(140, 18);
        // show initial frequency value
        labelValueFreq = new Label();
        if (showFreq) {
          labelValueFreq.setText("0000000 Hz");
          labelValueFreq.setForeground(fgColor);
          labelValueFreq.setAlignment(Label.LEFT);
          labelValueFreq.setFont(ctrlFont);
        Panel east = new Panel();
        east.setLayout(new BorderLayout(10, 10));
        east.add("North", labelVolume);
        Panel pEast = new Panel();
        pEast.add(pVolume);
        east.add("Center", pEast);
        Panel south = new Panel();
        Panel pSouth = new Panel();
        pSouth.setLayout(new FlowLayout(FlowLayout.CENTER));
        pSouth.add(labelFreq);
        pSouth.add(pFreq);
        pSouth.add(labelValueFreq);
        south.add("South", pSouth);
        linkPanel = new Panel();
        this.composeLink();
        Panel west = new Panel();
        // dummy label to enlarge the panel
        west.add(new Label("      "));
        add("North", linkPanel);
        add("South", south);
        add("East", east);
        add("West", west);
        add("Center", canvas = new Canvas());
      private void composeLink() {
        linkPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 5));
        linkPanel.setFont(inactiveLinkFont);
        linkPanel.setForeground(Color.yellow);
        Label labelName = new Label(TITLE + " \u00a9");
          labelName.setForeground(inactiveLinkColor);
          labelName.setAlignment(Label.RIGHT);
        labelNS = new Label(" Neural Semantics   ");
          labelNS.setForeground(inactiveLinkColor);
          labelNS.setFont(inactiveLinkFont);
          labelNS.setAlignment(Label.LEFT);
        linkPanel.add(labelName);
        linkPanel.add(labelNS);
        // link to Neural Semantics website
        String h = getDocumentBase().getHost();
        if ((h.length() > 4) && (h.substring(0, 4).equals("www.")))
          h = h.substring(4);
        if ((h != null) && (! h.startsWith("neuralsemantics.com"))) {
          // create a hand cursor for the hyperlink area
          Cursor linkCursor = new Cursor(Cursor.HAND_CURSOR);
          linkPanel.setCursor(linkCursor);
          labelName.addMouseListener(this);
          labelNS.addMouseListener(this);
      private void switchAudio(boolean b) {
        // switch audio to ON if b=true and audio is OFF
        if ((b) && (! audioOn)) {
          try {
            sun.audio.AudioPlayer.player.start(soundStream);
          catch(Exception e) { }
          audioOn = true;
        // switch audio to OFF if b=false and audio is ON
        if ((! b) && (audioOn)) {
          try {
            sun.audio.AudioPlayer.player.stop(soundStream);
          catch(Exception e) { }
          audioOn = false;
      private void getChanges() {
        // create new sound wave
        mu = getWave(frequency, amplitude);
        // show new frequency value
        if (showFreq)
          labelValueFreq.setText((new Integer(soundFrequency)).toString() + " Hz");
        // shut up !
        switchAudio(false);
        // switch audio stream to new sound sample
        try {
          soundStream = new sun.audio.ContinuousAudioDataStream(new
                            sun.audio.AudioData(mu));
        catch(Exception e) { }
        // listen
        switchAudio(true);
        // Adapt animation settings
        double prop = (double)freqValue / (double)MAX_FREQ;
        ovalW = (int)(prop * cw);
        ovalH = (int)(prop * ch);
        ovalX = (int)((cw - ovalW) / 2);
        ovalY = (int)((ch - ovalH) / 2);
        int r = (int)(255 * prop);
        int b = (int)(255 * (1.0 - prop));
        int g = (int)(511 * (.5d - Math.abs(.5d - prop)));
        ovalColor = new Color(r, g, b);
        // start the timer
        startTime = System.currentTimeMillis();
        // things are fixed
        changed = false;
    //                               Thread
      public void start() {
        // create thread
        if (runner == null) {
          runner = new Thread(this);
          runner.start();
      public void run() {
        // infinite loop
        while (true) {
          // Volume or Frequency has changed ?
          if (changed)
            this.getChanges();
          // a touch of hallucination
          repaint();
          // let the children sleep. Shut up if inactive during more
          // than the fixed time.
          if (System.currentTimeMillis() - startTime > fixedTime)
            switchAudio(false);
          // let the computer breath
          try { Thread.sleep(100); }
          catch (InterruptedException e) { }
      public void stop() {
        this.cleanup();
      public void destroy() {
        this.cleanup();
      private synchronized void cleanup() {
        // shut up !
        switchAudio(false);
        // kill the runner thread
        if (runner != null) {
          try {
            runner.stop();
            runner.join();
            runner = null;
          catch(Exception e) { }
    //                     AdjustmentListener Interface
      public void adjustmentValueChanged(AdjustmentEvent e) {
        Object source = e.getSource();
        // Volume range : 0 - 10000
        // ! Scrollbar value range is inverted.
        // ! 100 = multiplier coefficient.
        if (source == barVolume) {
          amplitude = (MAX_AMPL - barVolume.getValue()) * amplMultiplier;
          changed = true;
        // Frequency range : 97 - 3591 Hz
        // ! Scrollbar value range represents a logarithmic function.
        //   The purpose is to assign more room for low frequency values.
        else if (source == barFreq) {
          freqValue = barFreq.getValue();
          frequency = (int)Math.pow(1.2d, (double)(freqValue + 250) / 10.0);
          changed = true;
    //                     MouseListener Interface
      public void mouseClicked(MouseEvent e) {
      public void mouseEntered(MouseEvent e) {
        // text color rollover
        labelNS.setForeground(activeLinkColor);
        labelNS.setFont(activeLinkFont);
        showStatus("Visit Neural Semantics");
      public void mouseExited(MouseEvent e) {
        // text color rollover
        labelNS.setForeground(inactiveLinkColor);
        labelNS.setFont(inactiveLinkFont);
        showStatus("");
      public void mousePressed(MouseEvent e) {
        try {
          java.net.URL url = new java.net.URL("http://www.neuralsemantics.com/");
          AppletContext ac = getAppletContext();
          if (ac != null)
            ac.showDocument(url);
        catch(Exception ex){ }
      public void mouseReleased(MouseEvent e) {
    //                              Painting
      public void update(Graphics g) {
        Graphics canvasGraph = canvas.getGraphics();
        if (img == null) {
          // get canvas dimensions
          cw = canvas.getSize().width;
          ch = canvas.getSize().height;
          // initialize offscreen image
          img = createImage(cw, ch);
          graph = img.getGraphics();
        // offscreen painting
        graph.setColor(bgColor);
        graph.fillRect(0, 0, cw, ch);
        graph.setColor(ovalColor);
        graph.fillOval(ovalX, ovalY, ovalW, ovalH);
        // canvas painting
        if (canvasGraph != null) {
          canvasGraph.drawImage(img, 0, 0, canvas);
          canvasGraph.dispose();
    //                          Sound processing
      // Creates a sound wave from scratch, using predefined frequency
      // and amplitude.
      private byte[] getWave(int freq, int ampl) {
        int lin;
        // calculate the number of samples in one sinewave period
        // !! change this to multiple periods if you need more precision !!
        int nSample = (int)(rate / freq);
        // calculate output wave frequency
        soundFrequency = (int)(rate / nSample);
        // create array of samples
        byte[] wave = new byte[nSample];
        // pre-calculate time interval & constant stuff
        double timebase = 2.0 * Math.PI * freq / rate;
        // Calculate samples for a single period of the sinewave.
        // Using a single period is no big precision, but enough
        // for this applet anyway !
        for (int i=0; i<nSample; i++) {
          // calculate PCM sample value
          lin = (int)(Math.sin(timebase * i) * ampl);
          // convert it to mu-law
          wave[i] = linToMu(lin);
        return wave;
      private static byte linToMu(int lin) {
        int mask;
        if (lin < 0) {
          lin = -lin;
          mask = 0x7F;
        else  {
          mask = 0xFF;
        if (lin < 32)
          lin = 0xF0 | 15 - (lin / 2);
        else if (lin < 96)
          lin = 0xE0 | 15 - (lin-32) / 4;
        else if (lin < 224)
          lin = 0xD0 | 15 - (lin-96) / 8;
        else if (lin < 480)
          lin = 0xC0 | 15 - (lin-224) / 16;
        else if (lin < 992)
          lin = 0xB0 | 15 - (lin-480) / 32;
        else if (lin < 2016)
          lin = 0xA0 | 15 - (lin-992) / 64;
        else if (lin < 4064)
          lin = 0x90 | 15 - (lin-2016) / 128;
        else if (lin < 8160)
          lin = 0x80 | 15 - (lin-4064) / 256;
        else
          lin = 0x80;
        return (byte)(mask & lin);
    //                             Applet info
      public String getAppletInfo() {
        String s = "The jazz machine" + LSEP + LSEP +
                   "A music synthetizer applet" + LSEP +
                   "Copyright (c) Neural Semantics, 2000-2002" + LSEP + LSEP +
                   "Home page : http://www.neuralsemantics.com/";
        return s;
      private void setAppletParams() {
        // read the HTML showfreq parameter
        String param = getParameter("showfreq");
        if (param != null)
          if (param.toUpperCase().equals("OFF"))
            showFreq = false;
        // read the HTML backcolor parameter
        bgColor = changeColor(bgColor, getParameter("backcolor"));
        // read the HTML controlcolor parameter
        ctrlColor = changeColor(ctrlColor, getParameter("controlcolor"));
        // read the HTML textcolor parameter
        fgColor = changeColor(fgColor, getParameter("textcolor"));
        // read the HTML fontsize parameter
        param = getParameter("fontsize");
        if (param != null) {
          try {
            fontSize = Integer.valueOf(param).intValue();
          catch (NumberFormatException e) { }
      private Color changeColor(Color c, String s) {
        if (s != null) {
          try {
            if (s.charAt(0) == '#')
              c = new Color(Integer.valueOf(s.substring(1), 16).intValue());
            else
              c = new Color(Integer.valueOf(s).intValue());
          catch (NumberFormatException e) { e.printStackTrace(); }
        return c;
    }thanks LIZ
    PS If you can help how do I Give the Duke dollers to you

    http://www.google.ca/search?q=java+oval+shape+to+plot&hl=en&lr=&ie=UTF-8&oe=UTF-8&start=10&sa=N
    Ask the guy who made it for more help

  • To make the Pricing Condition types inactive in Pricing Procedure

    Hi Experts,
    I am facing a senario where, in a sales order, pricing procedure, if one of the pricing condition type does not exist, then two other condition types (even though they are determined by condition records), should be either made inactive or should not appear in the pricing procedure.
    Example: If I have 3 condition types in Pricing Proc say
    YYY1, YYY2, YYY3, then the scenarios are
    a. If one of the condition types YYY1 is not determined, then, YYY2 and YYY3 should not be either determined in the sales order or should be made inactive. This same logic applies to both YYY2 and YYY3.
    b. If all three condition types are determined in Pricing Proc of the sales order, then, the price should be considered.
    If it was just YYY1 then, I could have done it in VOFM by writing a routine and assigning it to YYY2 and YYY3 in pricing proc. However, the scenario is to check the other condition types as well and make YYY1 inactive if any of the other condition type does not exist. Both condition types are determined after YYY1 which is another difficulty.
    I tried creating a dummy condition type  and assigning it to Pricing Proc (at the end of Pricing Proc). For this dummy condition I put in a pricing requirement which checks for all three condition types and if one does not exist, then it make other conitions inactive.
    However, this does not work in VA02 and VA03 as XKOMV is either not getting filled up or even if is getting filled, it is not having the condition type. It some times has condition records, and sometimes not... (not very sure why)
    So, I was thinking of using user exit for the same. However, I was unable to find a suitable user exit for the same where KONV table can be read or XKOMV can be filled.
    Can you please suggest if any user exit can be used for this or if we can implement it in a different way?
    Regards,
    Mukund S

    Hi,
    I think you can use condition exclusion functionality to select best pricing condition from a set of conditions in pricing.  You can compare conditions in many ways.
    I believe you can plot a solution with little research.  The below link is for your reference.
    [http://help.sap.com/saphelp_40b/helpdata/fr/93/743483546011d1a7020000e829fd11/content.htm]

  • Crosshair mouse tracker on Plot Chart

    Hi All,
    I have implemented a flex plot chart, which works fine (able to plot items to it).  I want to add a cross hair tracking device that will move along with the mouse.  The cross hair will draw a simple horizontal and vertical line crossing at the mouse pointer to the edges of the chart.  I already have registered for the mouse move event (I have a status line that prints the real world values based on x/y position as the mouse moves).  The crosshair implementation I have tried implementing causes the mouse tracking to act very strange...almost, in a lagging type behaviour.  I am using a Graphics object from the plot chart object.  I do a clear each time before I redraw the crosshair (as the mouse moves).  The 'clear' seems to be the core of the lag problem (if I comment out the 'clear', the tracking works fine..but of course the crosshair from the previous mouse position doesnt erase).  I didnt see an 'xor' type of function which is what I have used on like projects before. Any ideas or suggestions would be greatly appreciated.
    my plot char is  called tlat_chart.
    var G:Graphics = tlat_chart.graphics;
    G.clear();
    G.moveTo(somex, somey);
    G.lineTo(newx, somey);
    etc......

    Take a look at Eli's custom chart annotations here: http://demo.quietlyscheming.com/ChartSampler/app.html

  • Scatter Plot Problem!!

    Hello everyone,
    I am quite new at Labview and I have a question regarding plotting 2d-array in a scatter plot.
    I would like to plot my data as a scatter plot, which I have done with the Waveform graph, and now I would like to find out the area with the highest density in the scatter plot
    and mark the area with a circle...is it possible in Labview to realize this?? I would be very thankful for every tips!
    Thank You
    Best Regards 
    Yun

    Yes it is possible.  You said you are using a waveform graph, wouldn't an XY graph be a better choice?  I don't know the data you are getting so a waveform graph might be the right tool here.
    In either case you'll need to define a length of X that you want to find the denses amount of points.  So say X=1 so then you will find all the points between 0 and 1 and count them, then 0.1 to 1.1 and count them, then 0.2 to 1.2 for the length of X on your graph.  Doing this in a For loop will make it easy, and then your output will be an array of counts for each section.  Find the maximum using the Array Max & Min function.  
    Then you can highlight the graph using property nodes.  You can use a cursor, or annotation, or a custom picture.  The easiest would probably be an Annotation and in the Example finder there is one called "Graph Annotations" that find the minimum, maximum, and average values for a graph and put an overlay on the graph.
    Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
    If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously.

  • How do I place text on a ScatterGraph and have an arrow point to a data point on a plot?

    For example, show the minimum point with the string "MIN" and draw an arrow from the text to the minimum point.
    I am using Measurement Studio 7.0 with C#. This could be accomplished in MS 6.0 with annotations.

    The Measurement Studio 7.0 graphs (WaveformGraph and ScatterGraph) expose events that allow you to custom draw areas of the control. Most of these events appear as pairs of BeforeDraw____ and AfterDraw___. The BeforeDraw events are raised before the drawing begins and AfterDraw events are raised after the drawing has completed.
    In your case, you can attach an event handler to the AfterDrawPlotArea event of the ScatterGraph since you want to draw on top of everything that is drawn in the plot area. In the event handler:
    // Assuming e is the name of the AfterDrawEventArgs parameter.
    // Find the minimum y-value on the first plot in the Plots
    // collection of the graph.
    double[] xData = scatterGraph1.Plots[0].GetXData();
    double[] yData = scatterGraph1.Plots[0].GetYData();
    if (yData.Length > 0)
    double x = xData[0];
    double yMin = yData[0];
    for (int i = 1; i < yData.Length; ++i)
    if (yData[i] < yMin)
    x = xData[i];
    yMin = yData[i];
    // Map the data point to a point in device coordinates.
    PointF minPoint = scatterGraph1.Plots[0].MapPoint(e.Bounds, x, yMin);
    // Calculate the starting point for the line of the
    // arrow.
    PointF startingPoint = new PointF(minPoint.X + 1, minPoint.Y - 1);
    PointF endingPoint = new PointF(minPoint.X + 10, startingPoint.Y - 9);
    // Draw a vertical line representing the stick of the
    // arrow from the point.
    e.Graphics.DrawLine(Pens.White, startingPoint, endingPoint);
    PointF leftArrowEnd = new PointF(startingPoint.X, startingPoint.Y - 3);
    PointF rightArrowEnd = new PointF(startingPoint.X + 3, startingPoint.Y);
    // Draw the arrows.
    e.Graphics.DrawLine(Pens.White, startingPoint, leftArrowEnd);
    e.Graphics.DrawLine(Pens.White, startingPoint, rightArrowEnd);
    // Calculate the location of the text by centering it
    // about the arrow.
    SizeF textSize = e.Graphics.MeasureString("MIN", scatterGraph1.Font);
    PointF textLocation = new PointF(endingPoint.X + 1, endingPoint.Y - (textSize.Height / 2));
    // Draw the "MIN" string
    e.Graphics.DrawString("MIN", scatterGraph1.Font, Brushes.White, textLocation);
    Hope this helps.
    Abhishek Ghuwalewala
    Measurement Studio
    National Instruments
    Abhishek Ghuwalewala | Measurement Studio | National Instruments

  • Problem printing annotations in CWGRAPH control with VB6

    I am attempting to print a cwgraph control in VB6 using the ControlImage(or ControlImageEx) property and the annotations do not print correctly.  I am creating a series of annotations on the graph to represet if 1 or 2 infrared sensors are blocked.  The annontations are simple rectanges that are either filled with dark red (1 sensor blocked) or bright red (both sensors blocked).  On the form, this works perfectly.  The control image shows the annotations as not filled in.  I have attached a picture demonstrating what I am seeing.  The top image is from a printout and the bottom is what is displayed on the screen.
    Using ControlImage or ControlImageEx makes no difference. This is with the latest version of measurement studio 8.5 in vb6. 
    Thanks in advance.
    Attachments:
    graph.png ‏12 KB

    Hi Lars,
    I am printing using a DataReport so what I do is this:
    With Profile.Sections("ProfileData_Detail")
        Set .Controls("imgGraph").Picture = Me.cwProfile(GraphNumber).ControlImageEx(Printer.PrintQuality, Printer.PrintQuality)
    End With
    I have tried using ControlImage and ControlImageEx with the same results. I have also tried saving the controlimage directly to a file with the same results.
    This is how I build the annotations for the graph:
        For g = 0 To 2
            With Me.cwProfile(g)
                For i = 0 To NumOccupancySamples
                    'Only create an annotation if an infared sensor is blocked.
                    If lane(LaneNum).Car.Profile(i).Sensor1Active = True Or lane(LaneNum).Car.Profile(i).Sensor2Active = True Then
                        Call BuildInfraredCoordinates(i, 1)  'Calculate the values for xCoordInfrared and yCoordInfrared.
                        .Annotations.Add
                        .Annotations(.Annotations.Count).CoordinateType = cwAxesCoordinates
                        .Annotations(.Annotations.Count).Shape.LineWidth = 0
                        .Annotations(.Annotations.Count).Shape.Type = cwShapeRectangle
                        .Annotations(.Annotations.Count).Shape.SetCoordinates xCoordInfrared, yCoordInfrared
                        'Fill rectangle if sensor is active
                        If lane(LaneNum).Car.Profile(i).Sensor1Active = True And lane(LaneNum).Car.Profile(i).Sensor2Active = True Then
                            'Both sensors blocked.
                            .Annotations(.Annotations.Count).Shape.FillVisible = True
                            .Annotations(.Annotations.Count).Shape.LineColor = COLOR_BOTH
                            .Annotations(.Annotations.Count).Shape.Color = COLOR_BOTH
                        Else
                            'Only 1 sensor blocked.
                            .Annotations(.Annotations.Count).Shape.FillVisible = True
                            .Annotations(.Annotations.Count).Shape.LineColor = COLOR_SINGLE
                            .Annotations(.Annotations.Count).Shape.Color = COLOR_SINGLE
                        End If
                        .Annotations(.Annotations.Count).Caption = ""
                        .Annotations(.Annotations.Count).SnapMode = cwCSnapFloating
                        .Annotations(.Annotations.Count).Plot = 1
                    End If
                Next i
            End With
        Next g
    The annotations just indicate if none, 1 or both infrared sensors where blocked.
    Thanks.

  • Graph Annotations - Major Bug !!!!!

    I am using annotations on a NiGraph control(2D, single plot chart). I update the X and Y coordinates of specific annotations using m_Graph.Annotations.Item(item).Caption.SetCoordinates(... , ...)
    this is done around 3 times per second. Each call to SetCordinates(...,...) causes a memory leak!!! Over a period of time my application uses up all system memory. I have validated this bug by running the National Instruments Annotations example and pressing the 'Generate Waveform' button whilst monitoring the memory usage using NT's Task Manager. Your example also leaks memory each time the annotations are repositioned !!!. Each time my graph is scaled X or Y (I use a slide control for this purpose) I reposition all annotations so they
    fit nicely in the view port of the graph. This operation generates many calls to the m_Graph.Annotations.Item(item).Caption....etc) and subsequently leaks memory at a vast rate. Graph annotation are the cornerstone of my application and I am very concearned that due to this bug my application is unusable.
    I would appreciate any help on this matter.
    Shaun

    I must disagree with your answer. I feel that the discussion forum the ideal place to warn engineers around the world of the problems with your software. This posting could save developers such as myself from developing a, at present, useless (and expensive) application. I did indeed request support and reported this bug to National Instruments (UK). Unfortunately they had no knowledge of it and could not help me any further but thanked me for pointing it out and advised me to “Watch the website for future Measurement Studio Updates”. As the Product Support Engineer for Measurement Studio and LabWindows/CVI I feel you answer was far from helpful, only pointing out this bug has been verified. Information such as possible work arounds, new
    version release dates or patches would have been useful. Perhaps even helpfully passing my details to one of your Technical Engineers so we might arrive at a solution. I would have rated the answer 0.5 stars but there was no icon to click.

  • Classic plot legend transparent background

    So I want to do some custom annotations to a graph using a picture control behind a graph. Since I like the classic graph’s look, I’m using the classic graph (but this is not necessarily necessary –is that correct English?).
    So my problem is this: When I make the graph BG transparent (to show the picture control with the custom graphics on it), the plot legend also shows the transparent BG in the little preview graph next to the plot name. Unfortunately, NI has placed the Visible Boolean behind this preview such that when you make the BG transparent, you see an old-school Boolean switch behind the damn plot example! This looks totally unacceptable. Is there any way to keep the BG from changing in the plot legend or any other way to fix this?
    Thanks!
    -Richard
    "Computers are useless. They can only give you answers." - Pablo Picasso
    Solved!
    Go to Solution.

    Here's an example of what I'm talking about. Notice how the plot legend exposes the Visible Boolean when you make the BG transparent. Try to imagine that the picture control actually has something useful in it...
    I suppose it might be possible to take a screenshot of the graph and then bring the picture control to the front with some sort of superposition of the screen shot and the image, but this seems like too much work and possibly prone to errors.
    "Computers are useless. They can only give you answers." - Pablo Picasso
    Attachments:
    Plot BG.vi ‏20 KB

  • Graph plot color

    Dear all,
    is there any way to have multiple colors in a single plot ?
    here's a brief of what i am trying to do:
    a graph is continuously running with a value '0'. when the stimulus is given, the value '1' is shown on the graph(just one value when the stimulus is given) and '-1' when it gets the response. the user sometimes gives response when no stimulus is given. that would be invalid response.
    so if the response is valid i want to show '-1' as green and if it is an invalid response i want to show '-1' in red.
    i am attaching the pic of the Graph .
    how can i achieve that ??
    Thanks,
    Ritesh 
    Solved!
    Go to Solution.
    Attachments:
    Plot.png ‏3 KB

    MikeS81 wrote:
    Hi Ritesh,
    a single waveform can only have one color. Maybe you can use annotations. See the "Programmatically Annotate a Graph.vi" Example to get more information.
    Mike
    Correct!
    So we have to resort to using a second plot to highlight the parts of the plot tht are out of spec.
    I've used two methods
    1)
    Use second plot that has "naN' values for all points that are in spec and the actual values when out of spec. "NaN' points will not plot so the second plot will only paint when the values are out. Optionally set the "fill collor" of the second plot to "zero" and you will get blobs under that bad resposnses.
    2)
    More work but do what CC suggested in this thread where he uses the "NaN" trick on the first plot as well to shut off the normal plot while the value is out of spec.
    Have fun!
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Annotation​'s "D1","D2",​... to be added to graph when points are added to graph....

    hi ...
    Good morning...
    Text labels "p1","p2" , & so on ... should be named for points added to the graph for plot 1 only not all plots...  .
    As in the graph when a particular point is ploted we can right click on graph & add annotation ... to mark tht point ...
    but if we dont want user to do it manually.. & as the points will be  ploted in graph tht  points should be labeled  p1,p2,.respectively..... then how to go about it ...
    I tried checking in property node .. annotation list is thr ... but all i want is just the point name to b changed for each point not other properties...
    I am Using LABview 8.0
    Waiting in anticipation ...
    Regards
    Yogan

    Hi yogan,
    In order to do this you can read the AnntList property which will output an array of clusters. You can then modify just the Name value in a cluster and write it back to the AnntList property.  There is an example that ships with LabVIEW that demonstrates programmatically editing annotations.  You can find this in LabVIEW by going to the Help menu, and clicking on Find Examples.  Then browse to Fundamentals >> Graphs and Charts >> Programmatically Annotate a Graph.vi.  Specifically, pay attention to the "Avg" Value Change event in the Event Structure.  This shows how to modify the name of an annotation.
    I hope this helps!
    Brian A.
    National Instruments
    Applications Engineer

  • Draw rectangle in plot

    How can i draw rectangle in graph
    with Component works++?

    Annotations were introduced to the C++/ActiveX graph in Measurement Studio 6.0. This is the best way to draw a rectangle.
    Details:
    CNiAnnotation:hape is a property of type CNiShape. CNiShape::Type is an enumeration, one value of which is CNiShape::Rectangle. Use CNiShape::XCoordinates and CNiShape::YCoordinates to specify the location and size of the rectangle. Use CNiAnnotation::CoordinateType to specify whether the coordinates of the rectangle are in axis units or in pixels relative to plot area or screen area.
    If you cannot upgrade to Measurement Studio 6.0, you could consider using 2 cursors as a workaround.
    David Rohacek
    National Instruments

Maybe you are looking for