Esther Marks

Esther Marks

  • 2.1k
  • 4
  • 255

Building Pie Chart LinQ C#

Feb 13 2021 11:41 AM
Hello everybody,
I've surfed a lot to find an awnser but failed every time, so hopefully anybody can help me.
I'm using LinQ in combi with C# and i want to build a pie chart.
Normall a Report will be like this:
There will be 2 columns (Name test,Total Test and Amount)
There will be a lot of data in the rows.
How can I transfer these columns into a pie chart.
Kind Regards,
Esther
<document xmlns:db="urn:iVention.db" xml:space="default" name="MessageList-Analysis">
<styles>
<style name="margin-left"><margin-left> 5cm </margin-left></style>
<style name="iv-report-title-red">
<font-size>16</font-size>
<text-align>center</text-align>
<font-weight>bold</font-weight>
<color>red</color>
</style>
</styles>
<pages>
<page>
<table border="1">
<row>
<cell width="4"><b>Name Test</b></cell>
<cell width="4"><b>Total Tests</b></cell>
<cell width="4"><b>Total Amount</b></cell>
</row>
<db:for-each-linq>
<db:statement>
<![CDATA[
from record in Tests
where
record.TestId >= 1 &&
record.TestTasks.Count==0
group record by new {record.Name,record.Status} into sg
select new
{
sg.Key.Status,
c=sg.Count(),
c2=sg.Count() * 16,
sg.Key.Name,
};
]]>
</db:statement>
<row>
<cell>
<db:value-of select="Name" />
</cell>
<cell>
<db:value-of select="c" />
</cell>
<cell>
<db:value-of select="c2" />
</cell>
</row>
</db:for-each-linq>
</table>
</page>
</pages>
</document>

Answers (3)