Skip to content

[Coordo Backend] Feature - Adding a dashboard/graph engine to the lib #4

@RonanMorgan

Description

@RonanMorgan

This issue MAY be divided into smaller issues. The goal of this issue is to discuss and validate an approach to be able to generate charts on the dasboard, with an API similar to the one we are using for MapLibre.

Here are the steps I think are relevant :

  1. Define a JSON schema which could represents a set of graphs, for ex for a graph of medium height over months
{
   "package": "inventaire",
    "resource": "inventaire_id",
  "charts": [
    {
      "type": "line",
      "x": "month(date)",
      "y": "mean(ind.haut)"
    }
  ]
}
  1. Write a config parser which can take this config, and generates a list of ChartJS configurations (including the data), some logic can be reused from the map config parser, and the datapackage part of the code can be reused as-is.

  2. Write both a request handler (python side) and a createCharts() func (javascript side) which are able to instantiate charts in HTML elements and to update filters by communicating with each other (a lot of logic from the map part can also be reused here I think)

Here the complexity is to find a way which is easy to integrate for devs, but also can update multiple graphs depending on the same data source which can be at multiple places in the HTML, this part should be discussed further because I don't see a straightforward solution to this.

Maybe having we should add an explicit "source" object, which will be common to both the map and chart engine. And when updating filters it should not happens at the layer level but at the source (and this way, only one call to setSourceFilter(source, layer) would update the layers AND the graphs automatically. But that would require more change to the javascript part (because it would need to track the source-layer and source-chart relations and update them accordingly)

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Ready to dev

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions