frappe / charts

Simple, responsive, modern SVG Charts with zero dependencies
https://frappe.io/charts
MIT License
14.9k stars 716 forks source link

multiple numbers are overwritten for valuesOverPoints set to 1 #415

Open sankarcn opened 11 months ago

sankarcn commented 11 months ago

Expected Behaviour

When we chart a stacked bar graph with valuesOverPoints set to 1, then the value shown on top should have the total.

Actual Behaviour

Looks like multiple numbers are overwritten on each other giving a very unreadable output.

Steps to Reproduce:

new Chart("#chart", {
  "data": {
    "labels": [
      "Planned",
      "Actual",
      "Profit"
    ],
    "datasets": [
      {
        "name": "Planned",
        "values": [
          1350,
          1350,
          0
        ],
        "chartType": "bar"
      },
      {
        "name": "Overrun",
        "values": [
          0,
          7499,
          0
        ],
        "chartType": "bar"
      },
      {
        "name": "Profit",
        "values": [
          0,
          0,
          14188
        ],
        "chartType": "bar"
      }
    ],
    "yMarkers": [
      {
        "label": "",
        "value": 1350,
        "options": {
          "labelPos":"center"
        }
      }
    ]
  },
  "type": "bar",
  "height": 250,
  "barOptions": {
    "stacked": true,
    "spaceRatio": 0.2
  },
  "valuesOverPoints": 1,
  "axisOptions": {
    "yAxisMode": "tick",
    "xAxisMode": "tick",
    "xIsSeries": 0
  },
  "colors": [
    "#2986cc",
    "#f1c232",
    "#2cb100"
  ]
});

Error

NOTE: Add a GIF/Screenshot if required.

Frappé Charts version: Codepen / Codesandbox:

Miki471151 commented 9 months ago

Hello. I'd like to work on this issue. Please assign it to me.

sankarcn commented 9 months ago

Thank @Miki471151 . But I do not have access to assign issues.