Skip to content

Charts aren't self-validating, and Deno errors are hard to interpret #109

@BatmanAoD

Description

@BatmanAoD

When a chart doesn't have all necessary components, the error isn't seen until attempting to render the chart. When rendering with Deno, the errors are difficult to understand.

For instance, when trying to create a scatterplot without axis definitions and symbol size, I got this error:

Error: could not generate plot: JavaScript runtime error: TypeError: Cannot read properties of undefined (reading 'get')
    at dx ([echarts.js]:45:242937)
    at cartesian2d ([echarts.js]:45:241875)
    at [echarts.js]:45:244376
    at vx ([echarts.js]:45:244413)
    at e.getInitialData ([echarts.js]:45:380659)
    at e.init ([echarts.js]:45:158807)
    at e.<anonymous> ([echarts.js]:45:113758)
    at Array.forEach (<anonymous>)
    at E ([echarts.js]:35:5056)
    at e.<anonymous> ([echarts.js]:45:113391)
caused by: JavaScript runtime error: TypeError: Cannot read properties of undefined (reading 'get')
    at dx ([echarts.js]:45:242937)
    at cartesian2d ([echarts.js]:45:241875)
    at [echarts.js]:45:244376
    at vx ([echarts.js]:45:244413)
    at e.getInitialData ([echarts.js]:45:380659)
    at e.init ([echarts.js]:45:158807)
    at e.<anonymous> ([echarts.js]:45:113758)
    at Array.forEach (<anonymous>)
    at E ([echarts.js]:35:5056)
    at e.<anonymous> ([echarts.js]:45:113391)

I think it would be good for charming to do some or all of these:

  • Provide a simple way to validate a Chart. (In a typical builder pattern, there's a build() function that turns the builder into a final object, and performs validation on it.)
  • Document which elements of a chart are necessary for rendering
  • Do something to improve the JavaScript errors themselves (in particular, reading 'get' doesn't say what is missing)

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions