Compare different columns

Asked

Viewed 135 times

2

It is possible to generate the pie chart (pie) by comparing different columns of a DataTable?

I mean, I have one DataTable with 2 columns of values and wanted to create a pie chart for each row of the DataTable, thus comparing the two values.

DataTable:

Descricao | Val1 | Val2
xxxxxxxx  | 9999 | 8888
yyyyyyyy  | 1111 | 2222

I’m using the Microsoft Chart Control, which is native to . net

  • Yes, it is possible. The idea is to draw the graph completely from scratch? Or use something like .net charting?

  • 1

    @Renan, I’m using the Microsoft Chart Control, which is native to . net.

  • Edit the question to contain this information. This increases the chances of you getting a good answer, okay? And keep my upvote early.

1 answer

1


There is. The DataTable Microsoft has the facility to create objects of the type DataView.

In other words, they are filters or "SELECTS" that you can do inside a Datatable. You can create 2 DataView for each type of Chart you want to create and, for each Chart, you arrow the DataSouce of them for each DataView servant.

The advantage is that if you add or modify information in the Datatable, automatically this modification is reflected in all existing Dataviews and consequently in your Dataviews (maybe you need to make a rebind, but nothing too complicated).

Browser other questions tagged

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