-
Notifications
You must be signed in to change notification settings - Fork 29
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
Somehow the label doesn't show up for the top section of the bar chart #24
Comments
Hi @we-own-it , |
hi @y-takey, It shows all labels when i change to horizontal one but not for bar type of chart Regards, |
hi Y-takey, "chart.js": "2.7.2", these are the versions am using. let me know if versioning is the issue and what is the correct versions which i should use for the above 3. Regards, |
Hi @we-own-it , Thanks for the detail. and sorry I overlooked the issue title at first :( I couldn't reproduce this issue.
and my example code is: const chart = new Chart(document.getElementById("my-chart-1"), {
type: "bar",
// type: "horizontalBar",
data: {
labels: ["2010-2015", "2016", "2017", "2018", "2019"],
datasets: [
{ label: "IG", data: [0, 250, 7417.5, 650, 1455], backgroundColor: "rgba(244, 143, 177, 0.6)" },
{ label: "HY", data: [0, 0, 0, 1000, 0], backgroundColor: "rgba(255, 235, 59, 0.6)" },
{ label: "NR", data: [0, 675, 4182.5, 1505, 1735], backgroundColor: "rgba(100, 181, 246, 0.6)" }
]
},
options: {
plugins: {
stacked100: { enable: true },
datalabels: {
anchor: "end",
align: 'bottom',
formatter: (_value, context) => {
const { datasetIndex, dataIndex } = context;
const rawValue = context.chart.data.originalData[datasetIndex][dataIndex]
return rawValue || "";
}
}
}
}
}); Could you try again after upgrade your versions? |
hi @y-takey, regards, |
Hi @y-takey, Think you can even try ur sample with a title. any suggestions on how to handle title with the stacked100. regards, |
Oh, sorry I looked chartjs-plugin-datalabels ( NOT data-labels) Do you need to support |
I am creating the bar chart with below combination, all good only the issue is 'datalabels" shows up the calculated value as default after mouse over the original data comes up. any help would be great.
When I use the below code it's throws error originalData is not a property.
|
@kbabraj Can you provide a repository that can reproduce the problem? |
Thank for the reply, by changing the below code I can see the original value now, plugins: { |
you can use triple backticks syntax to format code. :) |
Hi,
it shows fine if i change bar to horizontalbar chart.
regards,
Sunil
The text was updated successfully, but these errors were encountered: