You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to show labels on my line chart. I do not want the label shown to be the value.
The default plugin showned below onlys allows to use the values as the labels: protected override async Task OnAfterRenderAsync(bool firstRender) {if (firstRender) { // pass the plugin name to enable the data labels await barChart.InitializeAsync(chartData: chartData, chartOptions: barChartOptions, plugins: new string[] { "ChartDataLabels" }); } await base.OnAfterRenderAsync(firstRender); }
Ideally I can create a new List synchronised with Data and add it to my dataset. An example of what I have in mind is shown below.
That would be great if we also have the option to have it showned and the tooltip when we mouse over. var dataset1 = new BarChartDataset() { Data = dataStartDays, CustomLabel = customLabelList, //This here would ideally be a list of labels syncrhonised with dataStartDays BackgroundColor = barColorsDataset1, BorderColor = barColorsDataset1, BorderWidth = new List<double> { 0 }, MinBarLength = 5, }; datasets.Add(dataset1);
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I want to show labels on my line chart. I do not want the label shown to be the value.
The default plugin showned below onlys allows to use the values as the labels:
protected override async Task OnAfterRenderAsync(bool firstRender)
{if (firstRender)
{
// pass the plugin name to enable the data labels
await barChart.InitializeAsync(chartData: chartData, chartOptions: barChartOptions, plugins: new string[] { "ChartDataLabels" });
}
await base.OnAfterRenderAsync(firstRender);
}
Ideally I can create a new List synchronised with Data and add it to my dataset. An example of what I have in mind is shown below.
That would be great if we also have the option to have it showned and the tooltip when we mouse over.
var dataset1 = new BarChartDataset()
{
Data = dataStartDays,
CustomLabel = customLabelList, //This here would ideally be a list of labels syncrhonised with dataStartDays
BackgroundColor = barColorsDataset1,
BorderColor = barColorsDataset1,
BorderWidth = new List<double> { 0 },
MinBarLength = 5,
};
datasets.Add(dataset1);
Beta Was this translation helpful? Give feedback.
All reactions