void ScatterPlot::SetAxisValueRange(float x_min, float x_max, float y_min, float y_max){ axis_ranges_[0][0] = x_min; axis_ranges_[0][1] = x_max; axis_ranges_[1][0] = y_min; axis_ranges_[1][1] = y_max; UpdateViewData(); this->updateGL(); }
void CSearchView::OnItemDelRow() { if(m_PageRowIndex<=1) { ::AfxMessageBox(L"无数据!"); return; } if(m_GridCtrl.IsValid(m_GridCtrl.GetFocusCell())) { int row=m_GridCtrl.GetFocusCell().row; if(row<=1) { ::AfxMessageBox(L"无效行!"); return; } int col=0; wstring szCondition; CString strKey1,strKey2; if(!CGlobal::GetKeywordOffset(m_Table,g_dbTableKeyList[m_Table].c_str(),&col)) { ::AfxMessageBox(L"删除失败,无法获取主键!"); S_LOG_FATAL(L"删除失败,无法获取主键:"<<col); return; } if(CUSTOMER_ITEM==m_Table) { strKey1=m_GridCtrl.GetItemText(row,col); strKey2=m_GridCtrl.GetItemText(row,col-1); szCondition=DB_TABLE_CUSTOMER_KEY1; szCondition=szCondition+L"=\""+strKey2.GetString()+L"\""+L" and "+DB_TABLE_CUSTOMER_KEY2+L"=\""+strKey1.GetString()+L"\""; }else{ strKey1=m_GridCtrl.GetItemText(row,col); szCondition=g_dbTableKeyList[m_Table]; szCondition=szCondition+L"=\""+strKey1.GetString()+L"\""; } if(!m_pSQLDriver->DeleteOneRecordWithCondition(m_Table,szCondition.c_str())) { ::AfxMessageBox(L"删除失败,无法更新数据库!"); S_LOG_FATAL(L"删除失败,无法更新数据库:"<<col); return; } UpdateViewData(); ::AfxMessageBox(L"删除成功!"); OnSearch(); }else{ ::AfxMessageBox(L"请点击单元格选择需要删除的行!"); } }
void CSearchView::OnItemAddOk() { if(m_PageRowIndex<=1) { ::AfxMessageBox(L"无数据!"); return; } if(m_GridCtrl.IsValid(m_GridCtrl.GetFocusCell())) { int row=m_GridCtrl.GetFocusCell().row; if(row<=1) { ::AfxMessageBox(L"无效行!"); return; } map<wstring,wstring>tmpMap; vector<wstring>tempVec; tmpMap=CGlobal::GetDBTableMap(m_Table); int colnum=(int)tmpMap.size(); for(int col_index=0;col_index<colnum;col_index++) { CString str=m_GridCtrl.GetItemText(row,col_index); if(!CheckValidity(str)) { ::AfxMessageBox(L"请输入有效数据!"); } tempVec.push_back(str.GetString()); } if(!m_pSQLDriver->WriteOneRecordToDataBase(m_Table,&tempVec)) { ::AfxMessageBox(L"更新数据库失败!"); return; } UpdateViewData(); ::AfxMessageBox(L"更新成功!"); OnSearch(); }else{ ::AfxMessageBox(L"请点击单元格选择需要更新的行!"); } }
void ScatterPlot::SetData(std::vector< float >& values){ data_values_.assign(values.begin(), values.end()); UpdateViewData(); }