Skip to content

Sample: Stacked bar

Live preview

Code

html
<div id="chart" style="width:800px;height:480px"></div>
<script type="module">
  import { Insight } from 'https://unpkg.com/@chartbuddy.io/embed';

  new Insight('#chart', {
    persist: false,
    chartData: {
      chartType: 'stackedBar',
      isDataTransposed: true,
      seriesData: [
        ['', 'Q1', 'Q2', 'Q3'],
        ['Product A', 40, 48, 52],
        ['Product B', 30, 28, 35],
      ],
      title: { visible: true, text: 'Mix by quarter' },
      subtitle: { visible: false, text: '' },
    },
  });
</script>

Developer & LLM documentation · Not the end-user Help Center · Help Center