Plotly.js: Should we add a *strict* (or *debug*) mode that runs `Plotly.validate` on every `newPlot` and `update` call before attempting to draw?

Created on 29 May 2017  路  6Comments  路  Source: plotly/plotly.js

which would essentially be a more general way to resolve https://github.com/plotly/plotly.js/pull/1736

I'm thinking this strict/debug mode would be set as a config argument. We could either log the attribute errors (as Plotly.validate currently does) or throw an error.

discussion needed feature

All 6 comments

Random question: does a bundle with stripped metadata affect at all what or how it's able to report errors? (Otherwise I like the idea of this as a config argument and of reporting as much/helpful information as we can.)

does a bundle with stripped metadata affect at all what or how it's able to report errors

In its current implementation, Plotly.validate doesn't log the attribute descriptions, so no, it wouldn't matter.

cc @phxnsharp if you weren't aware of this.

This sounds like exactly what we would prefer. Is there a sense of what type of performance hit this would involve?

Is there a sense of what type of performance hit this would involve?

At the moment, Plotly.validate is fairly fast. It clocks in at no worse than 50ms. Plotly.validate's execution time, in its current state, _scales_ with the number of "data" and "layout" attributes set.

That said, if we choose to implement https://github.com/plotly/plotly.js/issues/1998, Plotly.validate will likely slow down a little bit. It we only check for data arrays lengths, the performance hit will be small. But if we choose to check for invalid data items (e.g. null in scatter marker traces), this will make Plotly.validate's execution time _scale_ with the length of the data array - which will slow it down considerably for graphs with many data points.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

HunterMcGushion picture HunterMcGushion  路  3Comments

maxwell8888 picture maxwell8888  路  3Comments

etpinard picture etpinard  路  3Comments

n-riesco picture n-riesco  路  3Comments

jonmmease picture jonmmease  路  3Comments