MAIDR JavaScript API
    Preparing search index...
    • Defers reading a chart until plotly has finished drawing it.

      Plotly.newPlot returns with part of a chart still to come: a map waits for the outlines it fetches over the network, and only then draws the regions and works out each one's centroid. Plotly keeps what it is waiting for in gd._promises until it settles. A choropleth read before then had no centroids, so it was read as a list in the order it was declared rather than by compass direction.

      Waited for once per chart, and for DRAW_WAIT_MS at most: a chart whose outlines never arrive is read as it stands, as it was before.

      Parameters

      • element: HTMLElement

        Any element inside the plotly graph div, or the div itself.

      • ready: () => void

        Called once plotly has finished, or the wait has run out.

      Returns boolean

      Whether the caller should leave the chart until ready is called.