Adding Custom Data Tips to Plot Running in Real-Time
Show older comments
I am working on designing an app that plots seven different lines in real time to indicate how certain values are trending over time. I am trying to create custom data tips for each line that is plotted to display the values of all the other lines at that time as well as a few extra values. When I create the custom data tips when the plot is originally created all the custom data tip rows don't show any values, just labels. I tried creating a function to call the custom data tip functions again, so as to update with the latest values of the variables I am trying to include in the data tips. When I do this, I get an error saying "Value must be compatible with the data source". Is there any way to update the custom data tips while plotting in real time? The functions I am using are shown below.
function CreateDataTips(app)
%Discards Line Data Tips
app.discardsplot.DataTipTemplate.DataTipRows(1).Label = 'Date-Time';
app.discardsplot.DataTipTemplate.DataTipRows(2).Label = 'Packet Discards';
app.discardsplot.DataTipTemplate.DataTipRows(3) = dataTipTextRow('Packet Retries',app.Retries_all);
app.discardsplot.DataTipTemplate.DataTipRows(4) = dataTipTextRow('Packet Fails',app.Fails_all);
app.discardsplot.DataTipTemplate.DataTipRows(5) = dataTipTextRow('Bits Recieved',app.Recieved_all);
app.discardsplot.DataTipTemplate.DataTipRows(6) = dataTipTextRow('Bits Sent',app.Sent_all);
app.discardsplot.DataTipTemplate.DataTipRows(7) = dataTipTextRow('RSSI',app.RSSI_all);
app.discardsplot.DataTipTemplate.DataTipRows(8) = dataTipTextRow('SNR',app.SNR_all);
app.discardsplot.DataTipTemplate.DataTipRows(9) = dataTipTextRow('TX Rate',app.Rate_all);
%Retries Line Data Tips
%.... Same for other 6 lines
end
function UpdateDataTips(app)
%Discards Line Data Tips
app.discardsplot.DataTipTemplate.DataTipRows(3).Value = app.Retries_all;
app.discardsplot.DataTipTemplate.DataTipRows(4).Value = app.Fails_all;
app.discardsplot.DataTipTemplate.DataTipRows(5).Value = app.Recieved_all;
app.discardsplot.DataTipTemplate.DataTipRows(6).Value = app.Sent_all;
app.discardsplot.DataTipTemplate.DataTipRows(7).Value = app.RSSI_all;
app.discardsplot.DataTipTemplate.DataTipRows(8).Value = app.SNR_all;
app.discardsplot.DataTipTemplate.DataTipRows(9).Value = app.Rate_all;
%Retries Line Data Tips
%.... Same for other 6 lines
1 Comment
Nick Nauman
on 23 Jul 2021
Accepted Answer
More Answers (0)
Categories
Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!