question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Stacked bar chart, multiple series, named data

See original GitHub issue

I did a lot of digging and it seems we do not have a way to create multiple stacked bars containing named data. I mean a scenario where all the datapoints have unique names and values. So with a pseudo-syntax:

series1: [{"name":"A1a","data":[71]},{"name":"A1b","data":[54]},{"name":"A1c","data":[12]}],
series2: [{"name":"A1d","data":[17]},{"name":"A1e","data":[21]}],
series3: [{"name":"A2a","data":[97]},{"name":"A2b","data":[43]},{"name":"A3a","data":[81]},{"name":"A3b","data":[96]}]

Am I missing something? Does this make sense or is it too much of a corner case to even consider?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
junedchhipacommented, Nov 3, 2018

This is possible, just not documented currently 😃

You can attach any data you want in the series and then target in tooltips/dataLabels. You need to change the format of the data a little bit.

series: [{
  name: 'A',
  data: [{
      x: "A1",
      y: 10,
      name: 'Custom A1 Label' 
  }, {
      x: "A2",
      y: 16,
      name: 'Custom A2 Label' 
  }, {
      x: "A3",
      y: 11,
      name: 'Custom A3 Label' 
  }],
}, {
  name: 'B',
  data: [{
      x: "B1",
      y: 20,
      name: 'Custom B1 Label' 
  }, {
      x: "B2",
      y: 36,
      name: 'Custom B2 Label' 
  }, {
      x: "B3",
      y: 19,
      name: 'Custom B3 Label' 
  }],
}, {
  name: 'C',
  data: [{
      x: "C1",
      y: 16,
      name: 'Custom C1 Label' 
  }, {
      x: "C2",
      y: 6,
      name: 'Custom C2 Label' 
  }, {
      x: "C3",
      y: 12,
      name: 'Custom C3 Label' 
  }],
}],
tooltip: {
    x: { 
        show: true,
        formatter: function(val, opt) {
            var seriesIndex = opt.seriesIndex
            var dataPointIndex = opt.dataPointIndex

            return opt.w.config.series[seriesIndex].data[dataPointIndex].name
        }
    },
    y: {
        title: {
            formatter: function (seriesName, opt) {
                var seriesIndex = opt.seriesIndex
                var dataPointIndex = opt.dataPointIndex

                return opt.w.config.series[seriesIndex].data[dataPointIndex].x
            }
        }
    }
},

Full example

0reactions
HammSoftwarecommented, Dec 25, 2021

@HammSoftware do u find an answer ? )

We decided to migrate to Highcharts in the end.

Read more comments on GitHub >

github_iconTop Results From Across the Web

A Complete Guide to Stacked Bar Charts | Tutorial by Chartio
Stacked bar charts extend the standard bar chart by dividing each bar into multiple subcategories. Learn how to best use this chart type...
Read more >
How to Create Stacked Bar Chart for Multiple Series in Excel
This article shows step-by-step procedures to create Stacked Bar Chart for Multiple Series in Excel. Learn, download workbook and practice.
Read more >
How to Make a Stacked Bar Chart in Excel With Multiple Data?
Enter your data in Excel. · Load ChartExpo add-in for Excel as shown above in the blog. · Select Stacked Bar Chart in...
Read more >
How to create stacked bar chart with multiple series?
Stacked bar charts are charts with Y values stacked over one another in the series order. Shows the relation between individual values to...
Read more >
Creating a Stacked Column Chart with Multiple Data Sets
My problem is that, for example, the cell named "IW" shows up as "Automotive" on the chart I create. How do I isolate...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found