简体   繁体   English

如何在Visual Studio 2010上显示ASP.NET图表(框架4.0)?

[英]How to display ASP.NET Charts (Framework 4.0) on Visual Studio 2010?

I am developing a web application and now I am trying to develop a dashboard using ASP.NET charts. 我正在开发Web应用程序,现在我正在尝试使用ASP.NET图表开发仪表板。 I am trying now to develop a chart that shows the number of users who uses the system. 我现在正在尝试开发一个图表,该图表显示使用该系统的用户数量。 I have a table in my database that keeps the username of the users who uses the system. 我的数据库中有一个表,其中保留使用该系统的用户的用户名。 I dragged the chart from the toolbox to my web application as shown below. 我将图表从工具箱拖到我的Web应用程序中,如下所示。

    <asp:Chart ID="Chart1" runat="server" DataSourceID="SqlDataSource1">
                <series>
                    <asp:Series Name="Series1">
                    </asp:Series>
                </series>
                <chartareas>
                    <asp:ChartArea Name="ChartArea1">
                    </asp:ChartArea>
                </chartareas>
            </asp:Chart>
            <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                ConnectionString="<%$ ConnectionStrings:testConnectionString %>" SelectCommand="SELECT COUNT(DISTINCT Username) AS NumberOfUsers FROM  dbo.UserQuiz">
</asp:SqlDataSource>

I debbugged the file and I did not get any error but the browser does not show any chart in the website and I don't know why. 我对文件进行了解密,但没有收到任何错误,但浏览器未在网站上显示任何图表,我也不知道为什么。

I am using Visual Studio 2010 and .NET Framework 4.0 我正在使用Visual Studio 2010和.NET Framework 4.0

you can use this link for developing dashboards using Microsoft chart controls Building a Dashboard Using The Microsoft Chart Controls 您可以使用此链接使用Microsoft图表控件开发仪表板使用Microsoft图表控件构建仪表板

I hope it will helps you .... 希望对您有帮助。

This site has some videos about it that you can look through and get the idea. 该网站上有一些有关它的视频,您可以浏览并了解它。 It is difficult to say why it is not working. 很难说为什么它不起作用。 Do you have data in the database? 数据库中是否有数据? Do you have the correct connection string. 您是否有正确的连接字符串。 Have you tried to connect a datagrid with this datasource etc. 您是否尝试过将数据网格与此数据源等连接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM