I have a table called LibLights . This table I keep the items of a sale. In this table, I made a sum for Profit and Total. The problem is that, for example, selling with that ID: 100030087 it has 5 items and if I graph the sale, I will have the profit slice repeated 5 times (same percentage). Then you ask: Is there not a table that has the sale itself, stored? Yes the Release table exists, but in this table I have only the total sale. For her, according to the client, I can not calculate the profit from this sale. I thought about creating a DTO that merges the two tables and brings only Total and TotalTotal , but I have not yet done so. Would a DTO in this pattern solve? Would I have the graphic with a pizza and a slice just? Just to note, below my chart using SfChart
private async void CriaChart()
{
SfChart chart = new SfChart();
DataService dataService = new DataService();
try
{
PieSeries pieSeries = new PieSeries()
{
ItemsSource = await dataService.GetItensLibAsync(IdOrcamento),
XBindingPath = "LucroTotal",
YBindingPath = "SomaTotal"
};
pieSeries.DataMarker = new ChartDataMarker();
chart.Legend = new ChartLegend();
chart.Title.Text = "Gráfico da Venda";
pieSeries.DataMarker.LabelContent = LabelContent.Percentage;
chart.Series.Add(pieSeries);
this.Content = chart;
}
catch(Exception ex)
{
string err = ex.Message;
}
}