忒简单了阿==================================================================
博客空间:http://blog.csdn.net/lovingkiss
资源下载:http://download.csdn.net/user/lovingkiss
优惠接单开发,组件控件定制开发,成品源代码批发
联系方式:Q64180940 全天在线
==================================================================
博客空间:http://blog.csdn.net/lovingkiss
资源下载:http://download.csdn.net/user/lovingkiss
优惠接单开发,组件控件定制开发,成品源代码批发
联系方式:Q64180940 全天在线
==================================================================
博客空间:http://blog.csdn.net/lovingkiss
资源下载:http://download.csdn.net/user/lovingkiss
优惠接单开发,组件控件定制开发,成品源代码批发
联系方式:Q64180940 全天在线
==================================================================
private void view_duns()//by wyw308将右边listbox的项目显示成曲线
{
Chart1.Series.Clear();
Chart1.Legends["Default"].Docking=LegendDocking.Bottom;
Chart1.ChartAreas["Default"].AxisX.IntervalAutoMode = IntervalAutoMode.VariableCount; //by wyw308网格粗细
int m_count=lst_view.Items.Count;
// foreach(ListItem itmsel in lst_view.Items)//by wyw308循环组件的方式,不好
for(int i=0;i <m_count;i++)
{
// add_ser(Chart1,itmsel.Value,itmsel.Text);
add_ser(Chart1,lst_view.Items[i].Value,lst_view.Items[i].Text);//by wyw308添加serries
if(ckb_v.Checked)//by wyw308是否多y轴显示
{
// Set custom chart area position
Chart1.ChartAreas["Default"].Position = new ElementPosition(20,10,68,82);
Chart1.ChartAreas["Default"].InnerPlotPosition = new ElementPosition(5,0,90,75);
// Create extra Y axis for second and third series
// CreateYAxis(Chart1, Chart1.ChartAreas["Default"], Chart1.Series[name], 7+i*5, 8);
if(i>0)
CreateYAxis(Chart1, Chart1.ChartAreas["Default"],Chart1.Series[lst_view.Items[i].Text],8+(20-8)*i/m_count,9); //by wyw308动态显示Y轴位置
}
}
}
private void add_ser(Dundas.Charting.WebControl.Chart ds_chart,string code,string name)//by wyw308添加曲线的series
{
string dt_1=dtp_s.Value.ToString("yyyy-MM-dd").Replace("-","");
string dt_2=dtp_e.Value.ToString("yyyy-MM-dd").Replace("-","");
string sql="Select "+
" t1.NAME 指标名称,t1.UNIT 单位,t1.CODE 指标代码,"+
" t2.NOW_VALUE 日值,"+
// " to_char(t2.INCEPT_DATE,'mm-dd') 接收日期"+
" to_char(t2.INCEPT_DATE,'mm-dd') 接收日期"+
" From sts_dtarget t1,sts_dayvalues t2"+
" Where to_char(t2.INCEPT_DATE,'yyyymmdd')>='"+dt_1+"' And to_char(t2.INCEPT_DATE,'yyyymmdd') <='"+dt_2+"'And t2.CODE='"+code+"' And t1.code=t2.code order by t2.INCEPT_DATE";
MyOraComm.ConnForOracle cfo=new MyOraComm.ConnForOracle("dbf_connstr");
DataSet ds=cfo.ReturnDataSet(sql,"ser");
ds_chart.Series.Add(name);
ds_chart.Series[name].Type = SeriesChartType.Line;
for(int i=0;i <ds.Tables[0].Rows.Count;i++)
{
ds_chart.Series[name].Points.AddXY(ds.Tables[0].Rows[i]["接收日期"],ds.Tables[0].Rows[i]["日值"]);
// ds_chart.Series[name].Points.AddXY(DateTime.Parse(ds.Tables[0].Rows[i]["接收日期"].ToString()),ds.Tables[0].Rows[i]["日值"]);
// ds_chart.Series[name].Points.AddY(ds.Tables[0].Rows[i]["日值"]);
ds_chart.Series[name].ToolTip = "#SERIESNAME\nX:#AXISLABEL\nY:#VALY";//by wyw308显示提示信息
// ds_chart.ChartAreas["Default"].AxisX.LabelStyle.Format = "ddd";//by wyw308格式化数据,没效果
// ds_chart.ChartAreas["Default"].AxisX.LabelStyle.ShowEndLabels = false;
}
cfo.CloseConn();
} 本文链接地址:http://www.net235.com/post/95.html 复制链接 | 加入收藏
转载请注明:转载自网络235 学无止境 [ http://www.net235.com/ ]