Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple Column series tooltip is not been shown #1804

Open
Daredevil749 opened this issue Dec 14, 2024 · 4 comments
Open

Multiple Column series tooltip is not been shown #1804

Daredevil749 opened this issue Dec 14, 2024 · 4 comments
Labels

Comments

@Daredevil749
Copy link

Daredevil749 commented Dec 14, 2024

So I am using 2 column series to display the data.The data is been shown correctly only issue is when I hover on to the individual Column incan see the tooltip of only 2 column series.Tooltip for 1 column series is not been shown.As seen in the images for column series which is purple in color the tooltip is not been shown.
IMG_20241214_180543
Also some of the labels of y axis are not been shown only if I zoom in it appears.

@martynasma
Copy link
Collaborator

Have you added tooltip to both series? If you can share your whole working code on CodePen, it would be easier.

@Daredevil749
Copy link
Author

Daredevil749 commented Dec 14, 2024

yAxis = chart.yAxes.push(
  am5xy.ValueAxis.new(root, {
    maxDeviation: 0.5,
    renderer: yRenderer,
  })
);

yAxis.children.unshift(
  am5.Label.new(root, {
    rotation: -90,
    y: am5.percent(50),
    centerX: am5.percent(50),
  })
);

xAxis = chart.xAxes.push(
  am5xy.CategoryAxis.new(root, {
    maxDeviation: 0.5,
    categoryField: "catgeoryvalue",
    renderer: xRenderer,
    tooltip: am5.Tooltip.new(root, {}),
  })
);

xAxis.children.unshift(
  am5.Label.new(root, {
    y: am5.percent(90),
    x: am5.percent(50),
  })
);

series.push(
  chart.series.push(
    am5xy.ColumnSeries.new(root, {
      name: "Series-1",
      xAxis: xAxis,
      yAxis: yAxis,
      valueYField: value1,
      categoryXField: "catgeoryvalue",
      tooltip: am5.Tooltip.new(root, {
        labelText: "{valueY}",
      }),
    })
  )
);

if (chartdata.length == 2) {
  series.push(
    chart.series.push(
      am5xy.ColumnSeries.new(root, {
        name: "Series-2",
        xAxis: xAxis,
        yAxis: yAxis,
        valueYField: value2,
        categoryXField: "catgeoryvalue",
        tooltip: am5.Tooltip.new(root, {
          labelText: "{valueY}",
        }),
      })
    )
  );
}

series.forEach((seriesData: any, index: any) => {
  seriesData.columns.template.setAll({
    cornerRadiusBR:  5,
    strokeOpacity: 0,
    fill: am5.color("#5e72e4"),
    stroke: am5.color("#5e72e4"),
  });

  seriesData.columns.template.adapters.add(
    "fill",
    function (fill: any, target: any) {
      let dataItem: any = target.dataItem;
      if (dataItem) {
        return am5.color(dataItem.dataContext.color);
      }

      return fill;
    }
  );

  seriesData.columns.template.adapters.add(
    "stroke",
    function (stroke: any, target: any) {
      let dataItem: any = target.dataItem;
      if (dataItem) {
        return am5.color(dataItem.dataContext.color);
      }

      return stroke;
    }
  );
});

@Daredevil749
Copy link
Author

I have added the tooltip for both series

@martynasma
Copy link
Collaborator

The code looks good. However, we can't test it. Would you be able to post your whole chart on CodePen?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants