请帮忙:owc画折线想跳过某个点怎么办?
我用c#调用owc画折线,我想判断某个点的值大于32700的话我就跳过这点,直接连下一个点,但是我画出来的图在跳过那点后就不画了,代码如下,请帮忙看看:while (sqlDisplay.Read())
{
for (int k = 0; k < aList.Count; k++)
{
string csTmp = aDisList[k].ToString();
string abc = sqlDisplay[aList[k].ToString().Trim()].ToString().Trim();
if (Convert.ToInt32(abc) < 32700)
{
csTmp += abc;
//csTmp += sqlDisplay[aList[k].ToString().Trim()].ToString().Trim();
csTmp += "\t";
aDisList.RemoveAt(k);
aDisList.Insert(k, csTmp);
}
else {
csTmp += "\t\t\t";
aDisList.RemoveAt(k);
aDisList.Insert(k, csTmp);
}
}
strCategory += sqlDisplay["hour"].ToString().Trim() + '\t';
cba = sqlDisplay[ee].ToString().Trim();
if (Convert.ToInt32(sqlDisplay[ee].ToString().Trim()) < 32700)
strValue += cba + "\t";
else {
strValue += "\t";
}
}
sqlDisplay.Close();
//创建ChartSpace对象来放置图表
ChChartSpace objCSpace = new ChartSpaceClass();
//在ChartSpace对象中添加图表,Add方法返回chart对象;
ChChart objChart = objCSpace.Charts.Add(0);
//指定图表的类型。类型由OWC.ChartChartTypeEnum枚举值得到
objChart.Type = ChartChartTypeEnum.chChartTypeLine; //曲线
objChart.ChartDepth = 10;
// objChart.Type = ChartChartTypeEnum.chChartTypeLineMarkers;//带节点的曲线
//objChart.Type = ChartChartTypeEnum.chChartTypeSmoothLine; //光滑曲线
//objChart.Type = ChartChartTypeEnum.chChartTypeColumnClustered; //条形
//标题
objChart.HasTitle = true;
SqlDataReader sqlShowname = cmd3.ExecuteReader();
while (sqlShowname.Read())
eename = Convert.ToString(sqlShowname[0]).Trim();
objChart.Title.Caption = IIiii + "站点" + yy + "年" + mm + "月" + dd + "日" + hh.ToString() + "时前后各12小时的"+eename+"及参考要素变化图";
sqlShowname.Close();
objChart.Title.Font.Bold = true;
objChart.Title.Font.Color = "blue";
objChart.Title.Font.Size = 16;
objChart.Title.Font.Name = "隶书";
//指定图表是否需要图例
//objChart.HasLegend = false;
objChart.HasLegend = true;
objChart.Legend.Font.Size = 10;
objChart.Legend.Position = ChartLegendPositionEnum.chLegendPositionTop;
//Axes[0]为X轴,Y轴
objChart.Axes[0].HasTickLabels = true;
objChart.Axes[0].TickLabelSpacing = 1;//每隔1个标一个数值
//objChart.Axes[0].TickMarkSpacing=4;//每隔5个作一个标志
objChart.Axes[0].HasTitle = true;
objChart.Axes[0].Title.Caption = "时间";
objChart.Axes[0].Title.Font.Size = 12;
//objChart.Axes[0].Title.Font.Name = "隶书";
// objChart.Axes[1].HasTitle = true;
// objChart.Axes[1].Title.Caption = "温度";
// objChart.Axes[1].Title.Font.Size = 12;
// objChart.Axes[1].Title.Font.Name = "隶书";
ArrayList colorList = new ArrayList();
colorList.Add("gold");
colorList.Add("green");
colorList.Add("purple");
colorList.Add("blue");
colorList.Add("brown");
for (int j = 0; j < aDisList.Count; j++)
{
//添加一个series
objChart.SeriesCollection.Add(j);
string xx = "select [chinesename] from TableInfo where [columnname]= '" + aList[j].ToString().Trim() + "'";
SqlCommand xCmd = new SqlCommand(xx, conn);
SqlDataReader readerx = xCmd.ExecuteReader();
string csname = "";
if (readerx.Read())
{
csname = readerx[0].ToString().Trim();
//给定series的名字
}
readerx.Close();
objChart.SeriesCollection[j].SetData(ChartDimensionsEnum.chDimSeriesNames,
(int)ChartSpecialDataSourcesEnum.chDataLiteral.GetHashCode(), csname);
//给定分类
objChart.SeriesCollection[j].SetData(ChartDimensionsEnum.chDimCategories,
(int)ChartSpecialDataSourcesEnum.chDataLiteral.GetHashCode(), strCategory);
//给定值
objChart.SeriesCollection[j].SetData(ChartDimensionsEnum.chDimValues,
(int)ChartSpecialDataSourcesEnum.chDataLiteral.GetHashCode(), aDisList[j].ToString().Trim());
objChart.SeriesCollection[j].Line.Color = colorList[j % 5].ToString().Trim();
}
//添加一个series
int nCount = aDisList.Count;
objChart.SeriesCollection.Add(nCount);
string xxx = "select [chinesename] from TableInfo where [columnname]= '" + ee + "'";
SqlCommand xxCmd = new SqlCommand(xxx, conn);
SqlDataReader readerxx = xxCmd.ExecuteReader();
string xcsname = "";
if (readerxx.Read())
{
xcsname = readerxx[0].ToString().Trim();
}
objChart.SeriesCollection[nCount].Interior.Color= "gray"; //改变第四条线的颜色为背景色
//给定series的名字
objChart.SeriesCollection[nCount].SetData(ChartDimensionsEnum.chDimSeriesNames,
(int)ChartSpecialDataSourcesEnum.chDataLiteral.GetHashCode(), xcsname);
readerxx.Close();
//给定分类
objChart.SeriesCollection[nCount].SetData(ChartDimensionsEnum.chDimCategories,
(int)ChartSpecialDataSourcesEnum.chDataLiteral.GetHashCode(), strCategory);
//给定值
objChart.SeriesCollection[nCount].SetData(ChartDimensionsEnum.chDimValues,
(int)ChartSpecialDataSourcesEnum.chDataLiteral.GetHashCode(), strValue);
// Microsoft.Office.Interop.Owc11.ChDataLabels d3 = objChart.SeriesCollection[3].DataLabelsCollection.Add();//显示每个点的值
// d3.HasValue = true;
objChart.SeriesCollection[nCount].Line.Color = "red";
//Cht.SeriesCollection(4).Line.Color = "blue"
conn.Close();
--------------------编程问答-------------------- 把一个折线 分成两条线 这样就ok了 --------------------编程问答-------------------- 很简单用图表组件wsChart4.5(DLL版)可以做到 --------------------编程问答-------------------- 可是我有多条曲线,并且曲线的条数也是动态的,只是其中的某些曲线可能会有一些要排除的点,怎么办呢?能否给说详细点呢,谢谢了 --------------------编程问答-------------------- 有朋友提到“把一个折线 分成两条线”,请问具体怎么实现?
而且有时候一条曲线上可能会有多个大于37200的值(断点值),如果一遇到断点值就分折线的话,又改怎么弄呢?
谢谢! --------------------编程问答-------------------- 请问,有没有朋友知道用owc控件画的一条曲线上某部分曲线(当值大于32700部分)用背景色显示怎么实现?感激万分!!! --------------------编程问答-------------------- 相关资料:http://blog.sina.com.cn/bigmoneyhunter
补充:.NET技术 , ASP.NET