Replies: 1 comment
-
|
Turns out it is quite straightforward... <h3>Pie Simple</h3>
<Chart Config="_config2" Height="400px" />
private PieChartConfig? _config2;
private Chart? _chart2;
protected override Task OnInitializedAsync()
{
_config2 = new PieChartConfig
{
Options = new PieOptions()
{
Responsive = true,
MaintainAspectRatio = false,
RegisterDataLabels = true,
Plugins = new Plugins()
{
DataLabels = new DataLabels()
{
Align = DatalabelsAlign.Center,
Anchor = DatalabelsAnchor.Center,
}
}
},
Data =
{
Labels = PieDataExamples.SimplePieText
}
};
_config2.Data.Datasets.Add(new PieDataset()
{
Label = "My First Dataset",
Data = PieDataExamples.SimplePie.ToList(),
BackgroundColor = SampleColors.PaletteBorder1,
HoverOffset = 4,
DataLabels = new DataLabels()
{
BackgroundColor = "black",
BorderRadius = 4,
Color = "white",
Font = new Font()
{
Weight = "bold"
},
Padding = new Padding(6)
}
});
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello!
Thank you for the amazing work so far :)
Would it be possible to have labels in a simple pie chart, the same way we have them for the line graph?
Beta Was this translation helpful? Give feedback.
All reactions