请问如何把统计直方图程序改造成统计直方图程序?
我有一段利用OWC画直方图的程序如下。现想改造成画曲线图的程序。不知道如何改造,特此请教。谢谢!using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections;
using System.ComponentModel;
using System.Data.SqlClient;
using System.Drawing;
using System.Web.SessionState;
using System.IO;
using Microsoft.Office.Interop.Owc11;
using System.Globalization;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DateTime dt = DateTime.Now;
int i = 0;
string ti = Request.Params["ti"];
ChartSpace objCSpace = new ChartSpaceClass();
ChChart objChart = objCSpace.Charts.Add(0);
objChart.Type = ChartChartTypeEnum.chChartTypeBarClustered;
objChart.HasLegend = true;
objChart.HasTitle = true;
objChart.Axes[0].HasTitle = true;
objChart.Axes[1].HasTitle = true;
int n = 7;
objChart.Axes[0].Title.Caption = "星期";
objChart.Axes[1].Title.Caption = "数";
string[] urlname = new string[n];
string[] bytes = new string[n];
string strCategory = "";
string strValue = "";
String[] wkn = new String[] { "星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日" };
for (i = 0; i < 7; i++)
{
urlname[i] = wkn[i];
int j = i % 3;
bytes[i] = j.ToString();
}
objChart.Title.Caption = "直方图";
for (i = n - 1; i >= 0; i--)
{
strCategory = strCategory + urlname[i];
strValue = strValue + bytes[i];
if (i > 0)
{
strCategory = strCategory + '\t';
strValue = strValue + '\t';
}
}
string strSeriesName = "";
objChart.SeriesCollection.Add(0);
objChart.SeriesCollection[0].SetData(ChartDimensionsEnum.chDimSeriesNames, (int)ChartSpecialDataSourcesEnum.chDataLiteral, strSeriesName);
objChart.SeriesCollection[0].SetData(ChartDimensionsEnum.chDimCategories, (int)ChartSpecialDataSourcesEnum.chDataLiteral, strCategory);
objChart.SeriesCollection[0].SetData(ChartDimensionsEnum.chDimValues, (int)ChartSpecialDataSourcesEnum.chDataLiteral, strValue);
ChDataLabels dls = objChart.SeriesCollection[0].DataLabelsCollection.Add();
dls.HasValue = true;
dls.Font.Name = "Verdana";
string str = "c:\\xyz.gif";
objCSpace.ExportPicture(str, "gif", 500, 500);
Image1.ImageUrl = str;
}
}
}
--------------------编程问答-------------------- objChart.Type = ChartChartTypeEnum.chChartTypeBarClustered;
改成:
objChart.Type = Microsoft.Office.Interop.Owc11.ChartChartTypeEnum.chChartTypeLine;
ChartChartTypeEnum有很多类型.你可以都试试..呵呵. --------------------编程问答-------------------- 另外b/s结构.string str = "c:\\xyz.gif";
最好不要直接引用图片..这样会有一个问题.好好想想吧..就是在多个人一起看图片..生成图片的时候.
会冲突的!
--------------------编程问答-------------------- 谢谢lovehongyun。如果不直接引用图片,还真不知道objCSpace.ExportPicture(str, "gif", 500, 500)中的str能填写成文件路径外的其他什么值。恳请继续赐教。多谢了! --------------------编程问答--------------------
补充:.NET技术 , ASP.NET