DataSet ds = db.Query("select date," + columnname + " from " + name);
Double[] dg = new Double[ds.Tables[0].Rows.Count];
Double[] bp = new Double[ds.Tables[0].Rows.Count];
DateTime[] dt = new DateTime[ds.Tables[0].Rows.Count];
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
dg = Convert.ToDouble(ds.Tables[0].Rows[1].ToString());
dt = Convert.ToDateTime(ds.Tables[0].Rows[0].ToString());
bp = Convert.ToDouble(ds.Tables[0].Rows[2].ToString()); ;
}
figure.Reset(true);//初始化图表
Axis xaxis = figure.View.AxisX;//获取图表X轴
Axis yaxis = figure.View.AxisY;//获取图表Y轴
figure.ChartType = ChartType.Line;//设置图表类型为曲线图
DataSeries g = new DataSeries();
DataSeries p = new DataSeries();
g.ValuesSource = dg;
g.ConnectionStroke = new SolidColorBrush(Colors.Red);
p.ValuesSource = bp;
xaxis.IsTime = true;
xaxis.AnnoFormat = "yyyy-MM-dd";
figure.Data.Children.Add(g);
xaxis.AnnoAngle = 15;
xaxis.MajorGridStrokeThickness = 0;
yaxis.MajorGridStrokeThickness = 0;
yaxis.Position = AxisPosition.Far;
yaxis.Title = "pr";
figure.Data.ItemNames = dt;
Axis bpaxis = new Axis();
bpaxis.AxisType = AxisType.Y;
figure.View.Axes.Add(bpaxis);
p.AxisY = bpaxis;
figure.Data.Children.Add(p);
问题出在倒数第二行
技术文档中的xaml代码中<c1chart:Axis Name="ay4" AxisType="Y" Position="Far" Min="0" Max="50" />
<c1chartataSeries AxisY="ay4" Values="1 2 3 4 5" />
表明dataseries.axisY 应该为一个string类型,但是在c#中如何设置我的p(dataseries类型)的数据绑定到bpaxis |
|