ni.com is currently undergoing scheduled maintenance.
Some services may be unavailable at this time. Please contact us for help or try again later.
04-29-2010 08:53 AM
Hallo Forum,
hat irgendjemand eine Idee, wie ich ein halbtransparentes Rechteck in einem Graphen darstellen kann? Ich habe eine Kurve, deren Min-, Max-, und Wendpunktwerte innerhalb einer Toleranz liegen müssen. Diese Toleranz möchte ich als Rechteck(Toleranzband) im Graphen darstellen. Damit die Kurve aber nicht komplett verdeckt ist, soll das Rechteck halbtransparent oder idealerweise von 0 bis 100%-Transparenz einstelbar sein. Im Anhang habe ich mal ein Bild eingefügt, wie ich es mir ungefähr vorstelle. Ist so etwas in CVI möglich? Wenn ja wie?
Gruß Thomas
Solved! Go to Solution.
04-29-2010 09:03 AM
Hallo Thomas,
halb- oder teiltransparent gibt es in CVI leider nicht... Vielleicht mal einen Produktvorschlag unterbreiten, ich hatte das neulich für Plotlinien gemacht.
Als eine mögliche Lösung könnte ich mir vorstellen:
1. Graph mit transparentem Hintergrund
2. Rechtecke in der gewünschten Farbe zeichnen und nach hinten setzen (z-Wert)
Damit werden die Plots oberhalb der rechtecke gezeichnet, so sieht man dann immerhin, ob die Kurven im Toleranzbreich sind.
Wolfgang
04-29-2010 11:42 AM - edited 04-29-2010 11:46 AM
Hello Thomas,
(I apologize for not writing in German, but my German is barely good enough to read. Attempting to write would have been comical).
If I understand your request correctly, I would imagine that Wolfgang's suggestion of placing the rectangles behind your line plot should do the job. However, if you really need the rectangles to be partially transparent you can still do so. This is how you would do it:
Here's some example code:
#define COLOR VAL_RED
#define TRANSPARENCY 128
#define WIDTH 100
#define HEIGHT 20
unsigned char alpha[WIDTH*HEIGHT];
unsigned int data[WIDTH*HEIGHT], i, j;
int bitmap, plot;
for (i = 0; i < WIDTH; i++)
for (j = 0; j < HEIGHT; j++)
{
data[i+j*WIDTH] = COLOR;
alpha[i+j*WIDTH] = TRANSPARENCY;
}
NewBitmapEx (WIDTH*sizeof(int), 32, WIDTH, HEIGHT, 0, (unsigned char *)data, 0, alpha, &bitmap);
plot = PlotBitmap (panelHandle, PANEL_GRAPH, 0.0, 1.5, 120.0, 0.5, 0);
SetCtrlBitmap (panelHandle, PANEL_GRAPH, plot, bitmap);
DiscardBitmap (bitmap);
04-30-2010 03:00 AM
Hello LuisG,
This is the solution! Many Thanks. I 've attached one curve with the tolerance width. But now by using the example code and not by using GIMP. Reading english is possible for me and i try my best to answer in english. Maybe it is a little bit comical.
Hallo Wolfgang,
auch Dir vielen Dank für Deinen Lösungsvorschlag und für die superschnelle Antwort.
Thank you very much!
Thomas