效果如下:左侧纵坐标表示柱形图Y轴数据,右侧纵坐标表示折线图Y轴数据
代码:
private void ButtonClickSelect()
{
string GD = textBoxGD.Text.Trim();
string XH = textBoxXH.Text.Trim();
string CJ = comboBoxCJ.Text.Trim();
string Date1 = dateTimePicker1.Value.ToString("yyyyMMdd HH:mm:ss");
string Date2 = dateTimePicker2.Value.ToString("yyyyMMdd HH:mm:ss");
DataTable dt = BLL.MES.GetNGBoLaTuP1(GD, XH, CJ, Date1, Date2);
if (dt != null && dt.Rows.Count > 0)
{
string ID_UNIQUE = BLL.Config.GetNewID();
dt.Columns.Add("BLL");
dt.Columns.Add("ID");
for (int i = 0; i < dt.Rows.Count; i++)
{
dt.Rows[i]["BLL"] = (Math.Round(decimal.Parse(dt.Rows[i]["NGQty"].ToString()) / decimal.Parse(dt.Rows[i]["TR"].ToString()), 2) * 100).ToString() + "%";
dt.Rows[i]["ID"] = ID_UNIQUE;
}
bool flag = Util.DBHelper.AddTable(dt, "NGBoLaTuTempSave");
if (flag)
{
chart1.ChartAreas["ChartArea1"].Area3DStyle.Enable3D = false;