Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chart traces do not always display #135

Open
psychemedia opened this issue Jul 9, 2021 · 2 comments
Open

Chart traces do not always display #135

psychemedia opened this issue Jul 9, 2021 · 2 comments
Labels
bug Something isn't working charting

Comments

@psychemedia
Copy link
Contributor

The display of chart traces is unreliable. Sometimes closing and opening the chart window can get things restarted. You also need to remember to enable particular traces. And log data into the console so that it can be displayed.

One of the issues with any fix is just being mindful of not adding any delay into the control loop. It's cluttered enough already. Not sure if things can be handled better in js using other processes to monitor things and do the charting based on watching for updates somewhere else.

@psychemedia psychemedia added bug Something isn't working charting labels Jul 9, 2021
@psychemedia
Copy link
Contributor Author

When traces are added, the chart component perhaps also needs updating?

So when we add traces (eg

Plotly.extendTraces('plotlyDiv', {
) should we also update the chart (eg https://plotly.com/javascript/plotlyjs-function-reference/#plotlyupdate )

Hmmm... or maybe I need to make sure that the checkboxes are adding things to the chart properly? eg https://plotly.com/javascript/plotlyjs-function-reference/#plotlyaddtraces and https://plotly.com/javascript/plotlyjs-function-reference/#plotlydeletetraces (although delete seems index based? So how do we keep track of that?)

I have completely forgotten how the chart handling works. This maybe needs reimplementing properly from scratch :-(

@psychemedia
Copy link
Contributor Author

psychemedia commented Oct 20, 2021

Not sure if the chart is properly setup in the first instance. When we click to show the chart, should we create a new chart eg as Plotly.newPlot('plotlyDiv', chart_lines);? If there is no chart previously set should we new Plot it, then .react() to update it if it does exist?

Current setup is setupFunctionToggleHandler('roboSim-display-chart', setupChartView);

So maybe update to:

function clearChart() {
  sim.previousChartTraces = [];
  set_chartlines()

  if (isEmpty($('#plotlyDiv'))) {
    Plotly.newPlot('plotlyDiv', chart_lines);
  } else {
    Plotly.react('plotlyDiv', chart_lines);
  }

Also, it's not clear that the chart lines are updated when we hit the checkboxes? How / when are lines added / removed to the chart?

In

if (sim.showChart) Plotly.react('plotlyDiv', chart_lines);
should we be creating a new chart?

How is chart cleared?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working charting
Projects
None yet
Development

No branches or pull requests

1 participant