10-14-2024 09:31 AM
So i want to display 2 graphs on the same display. Both of them being y=mx+b. I want to be able to change the m and b in both graphs. so it shows 2 different lines on the diplay.
I was thinking about using an XY graph, and then a loop that calculates maybe 10 points for each line? And then using those to make the lines? Could anyone help me with this, is there a more efficient way?
10-14-2024 09:37 AM - edited 10-14-2024 09:42 AM
@corned wrote:
So i want to display 2 graphs on the same display.
Your words are a bit ambiguous and I assume you want two plots on the same graph. Right?
You only need an xy graph if the x values are not spaced equally and not shared between the two plots.
All you need is create a ramp of x values (1D array of DBL), then calculate y1 and y2. To graph a line, it is sufficient to have two endpoints each.
the front pane will have one graph and controls for x range, slopes and offsets. The diagram should have a toplevel loop with a reasonable wait and the code that calculates the two lines based on the controls. How far did you get?
@corned wrote:Could anyone help me with this, is there a more efficient way?
You need to define words such as "efficient" that can mean many different things to different people (less code, faster code, less memory use, etc.)
Have you done any of the learning resources listed at the top of the forum?
10-14-2024 09:45 AM
yeah 2 plots on the same graph but everything i try doesnt work.
10-14-2024 09:52 AM - edited 10-14-2024 09:53 AM
Once you show us what you tried, we can tell you how to fix it.
Do you have a front panel with the required controls and indicators in the right representation? Have you decided on an x-range?
How far did you get with the diagram? Did you look at the help?
10-14-2024 09:54 AM - edited 10-14-2024 09:55 AM
Post your attempt so we can see where you have trouble...
Also, Help > Find Examples... Building User Interfaces > Displaying Data > Graphs and Charts
Look at Waveform Chart Data Types and Update Modes.vi and XY Graph Data Types.vi