0

我通过从我的数据库中挑选数据在winform中绘制图表。它工作正常。我需要的是,如果某些数据值大于最大值,则图中的该点会被突出显示或涂成红色。我怎样才能做到这一点?请帮忙。

String^  constring = L"datasource=localhost;port=3306;username=root;password=root;";
                 MySqlConnection^ conDataBase = gcnew MySqlConnection(constring);
                 MySqlCommand^ cmdDataBase = gcnew MySqlCommand("select * from `data`.`test`;",conDataBase); 
                 MySqlDataReader^ myReader;

                 try{
                     conDataBase->Open();
                     myReader = cmdDataBase->ExecuteReader();
                    // MessageBox::Show("Data Inserted");
                     while(myReader->Read()){

                         String^ v_datetime;
                         String^ v_temp;
                         v_datetime = myReader->GetString("datetime");
                         v_pressure = myReader->GetInt32("temp").ToString();

                         String^ status;
                         if (myReader->GetInt32("temp") > 1000 && myReader->GetInt32("temp") < 50 )


 {
                                 status = " Abnormal ";
**// and this point only should be highlited or different color in the graph**
                                                             }
                         else{
                            status = " Normal";
                         }

                         this->label3->Text = status;

                         this->chart2->Series["Temperature"]->Points->AddXY(v_datetime,myReader->GetInt32("temp"));
                        // comboBox1->Items->Add(vName);

                     }
                 }catch(Exception^ex){
                     MessageBox::Show(ex->Message);
                 }
4

1 回答 1

0

您不能向代表要绘制的对象的类添加一个属性,当您绘制图形时,您可以在此属性上进行测试并更改颜色、形状和大小。

于 2013-07-17T13:31:04.770 回答