How to display a single chart slice without repeating

Asked

Viewed 31 times

0

I have a table called Itenslib. 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, the sale with this ID:100030087 it has 5 items and if I chart this sale, I will have the profit share repeated 5 times (same percentage). Then you ask: Isn’t there a table that has the sale itself, stored? Yes there is the table Release, but in this table I have only the total of the sale. For it, according to the customer, I have no way to calculate the profit of this sale. I thought to create a DTO uniting the two tables and bringing only the Total and the Lucrototal, but I haven’t done it yet. Will a DTO in that pattern would resolve? Would I have the chart with a pizza and just a slice? Just for the record, below is 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;
            }
        }
  • following a simple logic...make a sale DTO, and within it, the list of items... done that you in the sales class you can perform any calculation involving the items...

  • @Rovannlinhalis, what do you mean. Let me understand this. What would that be like? The sale DTO only needs the ID and the Total and how would I call the items?

  • @Rovannlinhalis, I made a Join in lambda and it still didn’t work. I don’t know if that’s what you suggested.

  • honestly, I could not understand what the ultimate goal, rs sales chart, showing the percentage of profit of each item ?! is that it ?

  • @Rovannlinhalis, the customer asked me the following. A chart showing the total of the sale (summing all items) and the profit of that sale. This came in last, by my client. It turns out their bank is well outside the standards of a bank. Mainly that it has a totalizing table where I can get the total sale, but I have no way to calculate the profit and etc.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.