Issue
I used the Data label plugin to show Y value only, but as data structure attached below to show x and y axis
public barChartData:any ={
datasets: [
{
data: [{x:'Sales', y:20}, {x:'Revenue', y:10}],
label:"point 1",
backgroundColor:'rgba(238, 83, 79, 1)'
},
{
data: [{x:'Sales', y:40}, {x:'Revenue', y:40}],
label: "point 2"
}
]
};
These the data structure for chart, Is any way to show Y-value without changing the data Structure to Y value only in data.
Thanks in Advance
Solution
Using the Formatter Function inside options of datalabels
datalabels: {
formatter:(value, context) => {
return value.y
},
Answered By - MANOJKUMARG
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.