避免通过ASP.Net图表控件在服务器中创建.png文件 [英] Avoid creating .png file in server through ASP.Net chart control

查看:55
本文介绍了避免通过ASP.Net图表控件在服务器中创建.png文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,我正在使用ASP.Net 2.0图表控件,并且在本地计算机上运行(如果我运行时正在获取图形),也没有在我的文件夹中创建任何文件.当我从服务器运行相同的内容时,会得到图形,并且在服务器的根文件夹中也会生成图表的图像.如何避免在服务器中创建文件.

以下是我的.aspx和.cs页面

-.aspx页面包含

Hello I am using ASP.Net 2.0 charting control and in local machine if i run am getting graph and also not creating any files into my folder. when I run the same from server am getting the graph and also image of chart is being generated in the root folder of the server. How to avoid creating files in server.

Below is my pages both .aspx and .cs

---.aspx page contains

<asp:Chart ID="Chart1" runat="server" Width="950">
                    <Series>
                        <asp:Series Name="Series1">
                        </asp:Series>
                        <asp:Series Name="Series2">
                        </asp:Series>
                    </Series>
                    <ChartAreas>
                        <asp:ChartArea Name="ChartArea1">
                        </asp:ChartArea>
                    </ChartAreas>
                </asp:Chart>




我的.cs文件包含

在页面加载中,我打电话给




and my .cs file contains

In page load am calling

protected void Page_Load(object sender, EventArgs e)
   {





this.Chart1.DataSource = list;
        ConfigureChart();
    }







private void ConfigureChart()
    {
        Chart1.Titles.Add(new Title("Amount Collection Graph"));
        ConfigurTitle(Chart1.Titles[0]);
        ConfigureArea(Chart1.ChartAreas[0]);
        ConfigureSeries(Chart1.Series[0], "X", "Y1");
        Chart1.Series[1].ChartArea = Chart1.ChartAreas[0].Name;
    }
    private void ConfigureArea(ChartArea area)
    {
        //configure Chart Areas:
        area.ShadowColor = Color.Gray;
        area.ShadowOffset = 10;
        area.AxisY.Title = "Amount in Rs.";
        area.AxisX.Title = "Day's";
        area.AxisX.IsMarginVisible = true;
        area.Area3DStyle.Enable3D = display3d;
    }
    private void ConfigurTitle(Title title)
    {
        //configure Title:
        title.BorderColor = Color.Silver;
        title.BorderDashStyle = ChartDashStyle.Solid;
        title.ShadowColor = Color.Gray;
        title.ShadowOffset = 6;
        title.Font = new Font(FontFamily.GenericSansSerif, (float)13);
        title.IsDockedInsideChartArea = true;
    }
    private void ConfigureSeries(Series series, string xValue, string vValue)
    {
        //configure Series:
        series.XValueMember = xValue;
        //series
        //series["ShowMarkerLines"] = "True";
        series.YValueMembers = vValue;
        series.MarkerStyle = MarkerStyle.Square;
        series.IsValueShownAsLabel = showValues;
        series.Color = System.Drawing.Color.DodgerBlue;
        series.BorderColor = System.Drawing.Color.Blue;
        //series.XAxisType = AxisType.Secondary;
        series.ChartType = SeriesChartType.Line;
    }

推荐答案

您不能.这就是图表控件的工作方式. HTMLK无法重新生成图表,因此无法生成/显示图表,因此将创建图像,然后将其显示给用户.如果要真正的图表渲染,则必须使用RIA技术之一,例如Flex,Fusion或Silverlight.
You can''t. That''s the way the chart control works. HTMLK has no way of generating/displaying the chart as it is renedered, so an image is created, and then displayed to the user. If you want real chart rendering, you have to move to one of the RIA technologies, like Flex, Fusion, or Silverlight.


这篇关于避免通过ASP.Net图表控件在服务器中创建.png文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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