Title placement with 'amCharts5'

14 Views Asked by At

I'd like to have an amCharts5 chart with a vertical legend at its right side, like this:

enter image description here

and with a title at the top or the bottom. I can get the chart and the legend as on the picture but I'm unable to get the title.

I have a code like this:

// Create wrapper container
var container = root.container.children.push(
  am5.Container.new(root, {
    width: am5.p100,
    height: am5.p100,
    layout: root.horizontalLayout
  })
);
// Create venn series
var chart = container.children.push(
  am5venn.Venn.new(root, {
    categoryField: "name",
    valueField: "count",
    intersectionsField: "sets",
    paddingTop: 40,
    paddingBottom: 40,
    paddingLeft: 40,
    paddingRight: 40
  })
);
// Set data
chart.data.setAll(x.data);
// Add legend
var legend = container.children.push(
  am5.Legend.new(root, {
    layout: root.verticalLayout,
    centerX: am5.p100,
    x: am5.p100,
    centerY: am5.p50,
    y: am5.p50
  })
);
legend.data.setAll(chart.dataItems);

Now, how to set the title?

0

There are 0 best solutions below