- 积分
- 33
- 在线时间
- 53 小时
- 主题
- 28
- 注册时间
- 2013-8-31
- 帖子
- 132
- 最后登录
- 2019-10-21
- 帖子
- 132
- 软币
- 3320
- 在线时间
- 53 小时
- 注册时间
- 2013-8-31
|
本帖最后由 nbjjy 于 2013-8-31 19:16 编辑
一般常用的绑定方法
private void BtnQuery_Click(object sender, EventArgs e)
{
string sql = @"SELECT codedevice.s_devid,issue.s_saledt,issue.f_execamt FROM issue,codedevice noholdlock
WHERE (issue.s_posid = codedevice.s_devid) and (issue.s_saledt = (select max(issue.s_saledt) from issue))";
DataSet ds = Common.SybaseHelper.Query(sql);
this.chartControl1.DataSource = ds.Tables[0];
this.chartControl1.SeriesDataMember = "s_saledt";
this.chartControl1.SeriesTemplate.ArgumentDataMember = "s_devid";
this.chartControl1.SeriesTemplate.ValueDataMembers.AddRange(new string[] { "f_execamt" });
this.chartControl1.SeriesTemplate.PointOptions.ValueNumericOptions.Format = NumericFormat.Currency;
ChartTitle CT1 = new ChartTitle();
CT1.Text = "POS实时销售图";
chartControl1.Titles.Clear();
chartControl1.Titles.Add(CT1);
this.chartControl1.SeriesTemplate.View = new StackedBarSeriesView();
this.chartControl1.SeriesNameTemplate.BeginText = "销售日期: ";
}
柱形图
private void BtnQuery_Click(object sender, EventArgs e)
{
string sql = @"SELECT codedevice.s_devid,issue.s_saledt,issue.f_execamt FROM issue,codedevice noholdlock
WHERE (issue.s_posid = codedevice.s_devid) and (issue.s_saledt = (select max(issue.s_saledt) from issue))";
DataSet ds = Common.SybaseHelper.Query(sql);
this.chartControl1.Series.Clear();
Series S1 = new Series("柱状图", ViewType.Bar);
S1.ArgumentScaleType = ScaleType.Qualitative;
S1.DataSource = ds.Tables[0].DefaultView;
S1.ArgumentDataMember = "s_devid";
S1.ValueDataMembers[0] = "f_execamt";
S1.PointOptions.ValueNumericOptions.Format = NumericFormat.Currency;
this.chartControl1.Series.Add(S1);
ChartTitle CT1 = new ChartTitle();
CT1.Text = "POS实时销售图";
chartControl1.Titles.Clear();
chartControl1.Titles.Add(CT1);
this.chartControl1.Legend.Visible = false;//不现实指示图
}
饼形图
private void BtnQuery_Click(object sender, EventArgs e)
{
string sql = @"SELECT codedevice.s_devid,issue.s_saledt,issue.f_execamt FROM issue,codedevice noholdlock
WHERE (issue.s_posid = codedevice.s_devid) and (issue.s_saledt = (select max(issue.s_saledt) from issue))";
DataSet ds = Common.SybaseHelper.Query(sql);
Series Serices1 = new Series("饼形图 ", ViewType.Pie3D);
chartControl1.Series.Add(Serices1);
Serices1.DataSource = ds.Tables[0].DefaultView; ;
Serices1.ArgumentScaleType = ScaleType.Qualitative;
Serices1.ArgumentDataMember = "s_devid";
Serices1.ValueScaleType = ScaleType.Numerical;
Serices1.ValueDataMembers.AddRange(new string[] { "f_execamt" });
Serices1.PointOptions.PointView = PointView.ArgumentAndValues;
Serices1.PointOptions.ValueNumericOptions.Format = NumericFormat.Percent;
chartControl1.Visible = true;
}
|
|