如何将图例文本更改为x成员值? [英] How to change the legend text to the x member value?

查看:82
本文介绍了如何将图例文本更改为x成员值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在努力学习Visual C#,我正在尝试定制的饼图。

我的数据是关于犯罪报告的,我只需计算每个犯罪的频率地点。我已经将标签文本作为位置名称,但我无法将图例文本更改为犯罪类型。

这是我背后的代码:

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)
      {
          //Piechat customization----close enough.
          Chart1.Series[0]["PieLabelStyle"] = "Outside";

          //Show crime types as legend----???
          Chart1.Series[0].LegendText = "#CrimeTypeValues";

          //Show locations on the piechart as labels..done!
          Chart1.Series[0].Label = "#VALX";


      }





这就是我所做的:

图片链接



有没有办法展示犯罪类型值为传奇文本?





这是我对我的图表的SQL查询:



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.

推荐答案

这篇关于如何将图例文本更改为x成员值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆