plotly / plotly/dash-ag-grid

JavaScript function not recognized as a function in Dash AG Grid sparklines

Open
#329 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
241
Forks
47
PR merge metrics
No merged PRs in 30d

Description

A client has reported an issue where the function key in the formatter property for the agSparklineCellRenderer is not being recognized as a JavaScript function in enterprise sparklines. Instead, it is interpreted as a string, which leads to incorrect behavior.
Some properties in AG Grid take a JavaScript function as inputs according to the doc here

The issue occurs when using the following configuration in the AG Grid;

{
  "cellRenderer": "agSparklineCellRenderer",
  "cellRendererParams": {
    "sparklineOptions": {
      "type": "bar",
      "formatter": {"function": "params.value[0] < 0 ? {fill: #5470c6} : {fill: #a90000}"},
      "valueAxisDomain": [-15, 15],
      "paddingOuter": 0,
      "padding": {
        "top": 0,
        "bottom": 0
      },
      "label": {
        "enabled": true,
        "fontWeight": "bold",
        "placement": "outsideEnd"
      }
    }
  }
}

Reference Links:

https://community.plotly.com/t/aggrid-agsparklinecellrenderer-and-formatter-params/84780

https://dash.plotly.com/dash-ag-grid/javascript-and-the-grid#functions

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the agSparklineCellRenderer configuration and the Dash AG Grid JavaScript functions documentation linked in the issue. Reproduce the supplied sparkline setup and trace how the formatter value is passed to the enterprise sparkline. Done means the formatter is recognized as a JavaScript function rather than a string and the configuration behaves correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, python
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.