将WebChart以非图片的方式发布

来源:互联网 发布:台湾蛇毒血清丸淘宝网 编辑:程序博客网 时间:2024/05/16 00:56
            ChartEngine wcEng = new ChartEngine();
            wcEng.Size = new Size(200, 200);
            ChartCollection wcCharts = new ChartCollection(wcEng);
            wcEng.Charts = wcCharts;
            SmoothLineChart slChart = new SmoothLineChart();
            slChart.Line.Color = Color.Red;
            slChart.Legend = "Watts";
            slChart.ShowLineMarkers = false;
            slChart.ShowLegend = false;
            slChart.Data.Add(new ChartPoint("One", 12));
            slChart.Data.Add(new ChartPoint("Two", 22));
            slChart.Data.Add(new ChartPoint("Three", 2));
            wcCharts.Add(slChart);
 
            //' Uncomment this line to Set-up Optional properties on the chart
            //' SetMoreProperties(wcEng)
            Bitmap bmp;
            System.IO.MemoryStream memStream = new System.IO.MemoryStream();           
            bmp = wcEng.GetBitmap();
            bmp.Save(memStream, System.Drawing.Imaging.ImageFormat.Png);
            memStream.WriteTo(Response.OutputStream);
            Response.End();