I'm been trying to learn Visual C# and I'm trying to do a customized piechart.
My data is about crime reports, and I just need to compute the frequency of each crime per location. I already did the label text to be the location names, but I can't change the legend text to be the crime type.
Here is my code behind:
protected void Chart1_Load(object sender, EventArgs e)
{
Chart1.Series[0]["PieLabelStyle"] = "Outside";
Chart1.Series[0].LegendText = "#CrimeTypeValues";
Chart1.Series[0].Label = "#VALX";
}
Here's what I have done:
image link
Is there a way to show the crime type values as the legend text?
Here is my SQL query for my chart:
SELECT TOP (100) PERCENT CrimeLocation, CrimeType, COUNT(CrimeType) AS CrimeCount, 100 * CONVERT(DECIMAL(4, 2), COUNT(CrimeLocation)) /
(SELECT SUM(CrimeCount) AS Expr1
FROM dbo.view_nonindex_summary) AS Frequency
FROM dbo.tblInitialReport
GROUP BY CrimeType, CrimeLocation
ORDER BY Frequency DESC"
Thanks in advanced.