1 /*# ---------------------------------------------------------------------
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
9 # This software is governed by the CeCILL-B license under French law and
10 # abiding by the rules of distribution of free software. You can use,
11 # modify and/ or redistribute the software under the terms of the CeCILL-B
12 # license as circulated by CEA, CNRS and INRIA at the following URL
13 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14 # or in the file LICENSE.txt.
16 # As a counterpart to the access to the source code and rights to copy,
17 # modify and redistribute granted by the license, users are provided only
18 # with a limited warranty and the software's author, the holder of the
19 # economic rights, and the successive licensors have only limited
22 # The fact that you are presently reading this means that you have had
23 # knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */
26 /*=========================================================================
29 Module: $RCSfile: wxChart.cxx,v $
31 Date: $Date: 2012/11/15 14:15:18 $
32 Version: $Revision: 1.2 $
34 Copyright: (c) 2002, 2003
37 This software is distributed WITHOUT ANY WARRANTY; without even
38 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
39 PURPOSE. See the above copyright notice for more information.
41 =========================================================================*/
47 //----------------------------------------------------------------
48 // DataSet : Constructor & Destructor
49 //-------------------------------------------------------------------
50 wxDataSet::wxDataSet(wxPen *lStyle, wxBrush *dStyle, int dWidth,
51 int lWidth, int dGap, int pMark, int disValues)
58 m_displayValues = disValues;
64 wxDataSet::wxDataSet(wxPen *lStyle, wxBrush *dStyle,
65 wxString *lText, bool lDisplay)
80 wxDataSet::wxDataSet()
94 wxDataSet::~wxDataSet()
102 //-----------------------------------------------------------------
104 //-------------------------------------------------------------------
105 BEGIN_EVENT_TABLE(wxChart, wxPanel)
106 EVT_PAINT(wxChart::OnPaint)
109 //---------------------------------------------------------------------
110 // Constructor & Destructor
111 wxChart::wxChart(wxWindow *parent, wxWindowID id,
112 const wxPoint& pos, const wxSize& size,
113 long style, const wxString& name)
114 : wxPanel(parent, id, pos, size, style, name)
116 SetMaxWidthHeight(size.GetWidth(), size.GetHeight());
117 SetCenterChart(pos.x + (GetLargeur()/2), pos.y + (GetHauteur()/2));
126 for(int i=0; i<m_NumDataSet ; i++)
127 delete(m_dataSetArray[i]);
132 void wxChart::InitChart()
134 SetShowPer(false); //not display line % per default
135 for(int i=0; i<m_NumDataSet ; i++)
136 ShowDataSet(false, i);
141 //--------------------------------------------------------------
142 static double st_difference(double val, int multi, bool sens=true)
146 result = div(int(val), multi);
151 if ( result.rem == 0 ) {
152 if (val - (int)val > 0 )
153 retour = (multi - result.rem) - (val - int(val));
156 retour = (multi - result.rem) - (val - int(val));
162 retour = result.rem + (val - (int)val);
166 static double st_decalage(double IncX, double MinX)
168 double retour = 0.00;
172 result = div((int)MinX, (int)IncX);
173 if ( result.rem == 0 ) {
174 if (MinX - (int)MinX > 0 )
175 retour = ((result.quot + 1) * IncX) - MinX;
178 retour = ((result.quot+1) * IncX) - MinX;
184 static double st_origine(double IncX, double MinX)
186 double retour = MinX;
190 result = div((int)MinX, (int)IncX);
191 if (result.rem == 0) {
192 if (MinX - (int)MinX > 0 )
193 retour = (result.quot + 1) * IncX;
196 retour = (result.quot + 1) * IncX;
203 static void st_Inverse(double *l_MinCol, double *l_MaxCol)
205 if (*l_MinCol > *l_MaxCol) {
206 int tempo = (int)(*l_MaxCol);
207 *l_MaxCol = *l_MinCol;
213 //--------------------------------------------------------------
214 void wxChart::SetInfX(double inf)
219 void wxChart::SetSupX(double sup)
225 void wxChart::SetSupY(double sup)
231 void wxChart::SetIncAxisX(double minor, double major)
237 void wxChart::SetIncAxisY(double minor, double major)
244 void wxChart::SetInitEdge()
255 void wxChart::SetChartBounds()
257 m_Top = m_CenterY - (m_MaxHauteur/2) + m_EdgeTop;
258 m_Bottom = m_CenterY + (m_MaxHauteur/2) - m_EdgeBottom;
259 m_Left = m_CenterX - (m_MaxLargeur/2) + m_EdgeLeft;
260 m_Right = m_CenterX + (m_MaxLargeur/2) - m_EdgeRight;
263 void wxChart::SetChartBoundsLegend()
265 m_TopLegend = m_CenterY - (m_MaxHauteur/2) + m_EdgeTopLegend;
266 m_BottomLegend = m_CenterY + (m_MaxHauteur/2) - m_EdgeBottomLegend;
267 m_LeftLegend = m_CenterX - (m_MaxLargeur/2) + m_EdgeLeftLegend;
268 m_RightLegend = m_CenterX + (m_MaxLargeur/2) - m_EdgeRightLegend;
272 void wxChart::SetCadreLegend(int nbr, int *bottom)
274 int val=GetEdgeBottom();
275 div_t result = div(nbr, 2);
277 val+= (nbr * 10) + 5;
279 val+= (( nbr + 1 ) * 10) + 5;
282 SetEdgeTopLegend(m_CenterY + (m_MaxHauteur/2) - val + 33);
283 SetEdgeBottomLegend(8);
285 int l_left = GetEdgeLeft();
286 int l_right = GetEdgeRight();
288 // more small for only 1 line
290 l_left+=m_CenterX - (m_MaxLargeur/3);
291 l_right+=m_CenterX - (m_MaxLargeur/3);
294 SetEdgeLeftLegend(l_left);
295 SetEdgeRightLegend(l_right);
299 void wxChart::SetShowPer(bool per)
305 void wxChart::SetMaxValue(double max)
311 double wxChart::MaxValue()
313 double data, val = 1.00;
314 int maxdata = GetNumDataSet()-1;
315 int maxitem = GetNumItem();
317 // Exclure Stenosis for calcul MaxValue
318 for(int a=0; a < maxdata; a++) {
319 if (GetShowDataSet(a)) {
320 for(int j=0; j<=maxitem; j++) {
321 if ( IsEmpty(a,j) == false ) {
322 data = GetDataY(a,j);
334 double wxChart::MinCol(double min)
336 double retour = 0.00;
337 int maxdata = GetNumDataSet()-1;
339 // Exclure Stenosis for calcul MaxValue
340 for(int a=0; a < maxdata; a++) {
341 if (GetShowDataSet(a)) {
352 double wxChart::MaxCol(double max)
354 double retour = 1.00;
355 int maxdata = GetNumDataSet()-1;
357 // Exclure Stenosis for calcul MaxValue
358 for(int a=0; a < maxdata; a++) {
359 if (GetShowDataSet(a)) {
369 void wxChart::SetStepSizeX(double stepX)
374 void wxChart::SetStepSizeY(double stepY)
380 void wxChart::SetStepSizePer(double stepPer)
382 m_StepSizePer = stepPer;
386 void wxChart::SetCenterChart(int x, int y)
392 void wxChart::SetMaxWidthHeight(int x,int y)
399 void wxChart::SetMinX(double MinX)
405 void wxChart::SetMaxX(double MaxX)
412 void wxChart::SetEdgeTop(int top)
417 void wxChart::SetEdgeBottom(int bottom)
419 m_EdgeBottom = bottom;
422 void wxChart::SetEdgeLeft(int left)
427 void wxChart::SetEdgeRight(int right)
433 void wxChart::SetEdgeTopLegend(int top)
435 m_EdgeTopLegend = top;
438 void wxChart::SetEdgeBottomLegend(int bottom)
440 m_EdgeBottomLegend = bottom;
443 void wxChart::SetEdgeLeftLegend(int left)
445 m_EdgeLeftLegend = left;
449 void wxChart::SetEdgeRightLegend(int right)
451 m_EdgeRightLegend = right;
456 void wxChart::SetNumDataSet(int num)
461 void wxChart::SetNumItem(int num)
467 int wxChart::GetShow()
471 for(int i=0; i < m_NumDataSet ; i++) {
472 if (GetShowDataSet(i))
479 void wxChart::InitDataSet()
484 for(int i=0; i<MAX_DATASET ; i++)
485 m_dataSetArray[i]=NULL;
488 wxColour *BlueColour = new wxColour(0,0,255);
489 wxColour *GreyColour = new wxColour(192,192,192);
490 wxColour *YellowColour = new wxColour(255,255,0);
491 wxColour *VioletColour = new wxColour(255,0,255);
492 wxColour *CyanColour = new wxColour(0,255,255);
494 // Create All DataSet
495 // Per default : Show(false)
496 m_dataSetArray[wxArea] = new wxDataSet(wxRED_PEN, wxRED_BRUSH, (wxString*)"Area");
497 m_dataSetArray[wxPerimeter] = new wxDataSet(new wxPen(*BlueColour, 1, wxSOLID),
498 new wxBrush(*BlueColour, wxSOLID),
499 (wxString*)"Perimeter");
501 m_dataSetArray[wxDiameterArea] = new wxDataSet(new wxPen(*GreyColour, 1, wxSOLID),
502 new wxBrush(*GreyColour, wxSOLID),
503 (wxString*)"Diameter from area");
505 m_dataSetArray[wxDiameterPerimeter] = new wxDataSet(new wxPen(*YellowColour, 1, wxSOLID),
506 new wxBrush(*YellowColour, wxSOLID),
507 (wxString*)"Diameter from perimeter");
509 m_dataSetArray[wxMinimumDiameter] = new wxDataSet(new wxPen(*VioletColour, 1, wxSOLID),
510 new wxBrush(*VioletColour, wxSOLID),
511 (wxString*)"Minimum diameter");
513 m_dataSetArray[wxMaximumDiameter] = new wxDataSet(new wxPen(*CyanColour, 1, wxSOLID),
514 new wxBrush(*CyanColour, wxSOLID),
515 (wxString*)"Maximum diameter");
517 m_dataSetArray[wxAverageDiameter] = new wxDataSet(wxBLACK_PEN, wxBLACK_BRUSH, (wxString*)"Average diameter");
519 m_dataSetArray[wxStenosis] = new wxDataSet(wxGREEN_PEN, wxGREEN_BRUSH, (wxString*)"Stenosis");
525 //---------------------------------------------------------------------
526 void wxChart::OnPaint(wxPaintEvent& event)
533 void wxChart::Draw(wxDC& dc)
538 //----------------------------------------------------------------------------
543 //----------------------------------------------------------------------------
544 // Font : one for all chart
545 dc.SetFont(*(new wxFont(1, wxDEFAULT, wxNORMAL, wxLIGHT)));
547 //----------------------------------------------------------------------------
549 wxSize size = GetClientSize();
550 SetMaxWidthHeight(size.GetWidth(), size.GetHeight());
551 SetCenterChart((GetLargeur()/2), (GetHauteur()/2));
554 //-----------------------------------------------------------------------------
556 ShowDataSet(true,wxArea);
557 ShowDataSet(true,wxPerimeter);
558 ShowDataSet(true,wxDiameterArea);
559 ShowDataSet(true,wxDiameterPerimeter);
560 ShowDataSet(true,wxMinimumDiameter);
561 ShowDataSet(true,wxMaximumDiameter);
562 ShowDataSet(true,wxAverageDiameter);
563 ShowDataSet(true,wxStenosis);
570 ShowDataSet(true,wxStenosis);
573 //--------------------------------------------------------------------
577 SetCadreLegend(nbr, &m_EdgeBottom);
578 SetChartBoundsLegend();
582 //-------------------------------------------------------------------
583 // Valeur Min et Max des abscisses
586 SetInfX(st_difference(m_MinX,10,false));
587 SetSupX(st_difference(m_MaxX,10,true));
589 //------------------------------------------------------------------
593 SetData(wxStenosis, 0, 0, -45);
594 SetData(wxStenosis, 1, 0.4, 0);
595 SetData(wxStenosis, 2, 0.6, -15);
596 SetData(wxStenosis, 3, 0.8, 0);
597 SetData(wxStenosis, 4, 0.9, 100);
598 SetData(wxStenosis, 5, 1, 0);
601 SetData(wxArea,0, 0, 0.8);
602 SetData(wxArea,1, 0.2, 0.6);
603 SetData(wxArea,2, 0.3, 0.8);
604 SetData(wxArea,3, 0.4, 1);
605 SetData(wxArea,4, 0.8, 0.4);
606 SetData(wxArea,5, 1, 0.2);
608 //-----------------------------------------------------------------
609 // Valeur Max du chart
610 SetMaxValue(MaxValue());
611 SetSupY(st_difference(m_MaxValue, 10, true));
613 //-------------------------------------------------------------------------------
615 SetIncAxisX((m_MaxX + m_SupX - (m_MinX - m_InfX)) / (double)MINOR_STEP,
616 (m_MaxX + m_SupX - (m_MinX - m_InfX)) / (double)MAJOR_STEP);
617 SetIncAxisY((m_MaxValue + m_SupY) / (double)MINOR_STEP,
618 (m_MaxValue + m_SupY) / (double)MAJOR_STEP);
619 SetStepSizeX(( m_MaxLargeur - (m_EdgeLeft + m_EdgeRight + m_SupX + m_InfX)) /
621 SetStepSizeY(( m_MaxHauteur - (m_EdgeBottom + m_EdgeTop + m_SupY )) /
623 SetStepSizePer(( m_MaxHauteur - (m_EdgeBottom + m_EdgeTop)) /
626 //-----------------------------------------------------------------------------
628 //---------------------------------------------------------------------------
635 //-----------------------------------------------------------------------------
637 //---------------------------------------------------------------------------
638 dc.DestroyClippingRegion();
639 dc.SetClippingRegion(m_Left , m_Top ,
640 GetLargeur() - (m_EdgeRight + m_EdgeLeft ),
641 GetHauteur() - (m_EdgeTop + m_EdgeBottom ));
643 //---------------------------------------------------------------------------
645 //---------------------------------------------------------------------------
646 int maxdataset = GetNumDataSet();
647 for(int a=0; a < maxdataset; a++) {
648 if(m_dataSetArray[a] && m_dataSetArray[a]->GetShow()) {
649 dataBrush = m_dataSetArray[a]->GetDataStyle();
650 dataPen = m_dataSetArray[a]->GetLineStyle();
651 dc.SetBrush(*dataBrush);
657 //---------------------------------------
659 dc.DestroyClippingRegion();
664 void wxChart::DrawAxe(wxDC& dc)
671 double minorIncStepY= m_MinorIncY * m_StepSizeY;
672 double majorIncStepY= m_MajorIncY * m_StepSizeY;
673 double minorIncStepX= m_MinorIncX * m_StepSizeX;
674 double majorIncStepX= m_MajorIncX * m_StepSizeX;
676 dc.SetPen(*wxBLACK_PEN);
677 dc.SetBrush(*wxBLACK_BRUSH);
680 dc.DrawLine(m_Left, m_Bottom+(7*MARGE/4), m_Right, m_Bottom+(7*MARGE/4));
682 dc.DrawLine(m_Left-(7*MARGE/4), m_Bottom, m_Left-(7*MARGE/4), m_Top);
685 // Major Tick Marks with values
687 for(x=m_Left,y=m_Bottom; y >= m_Top; y-=majorIncStepY, val+=m_MajorIncY) {
688 dc.DrawLine( (int)(m_Left-7-(7*MARGE/4)) , (int)(y) , (int)(m_Left-(7*MARGE/4)) , (int)(y) );
689 sprintf(text,"%g", val);
690 dc.GetTextExtent(wxString(text, wxConvUTF8),&widthx,&heighty);
691 dc.DrawText(wxString(text, wxConvUTF8), (int)(m_Left-10-widthx-(7*MARGE/4)) , (int)(y-(heighty/2)) );
695 dc.DrawLine(m_Left-7-(7*MARGE/4),m_Top,m_Left-(7*MARGE/4),m_Top);
696 sprintf(text,"%g", val);
697 dc.GetTextExtent(wxString(text, wxConvUTF8),&widthx,&heighty);
698 dc.DrawText( wxString(text, wxConvUTF8),m_Left-10-widthx-(7*MARGE/4),m_Top-(heighty/2));
702 for(x=m_Left,y=m_Bottom; y >= m_Top; y-=minorIncStepY) {
703 dc.DrawLine((int)(m_Left-3-(7*MARGE/4)) , (int)(y) , (int)(m_Left-(7*MARGE/4)) , (int)(y) );
707 // Major Tick Marks with values
708 supx = st_decalage(m_MajorIncX, m_MinX) * m_StepSizeX;
709 val = st_origine(m_MajorIncX, m_MinX);
710 for(y=m_Bottom,x=m_Left + supx; x <= m_Right; x+=majorIncStepX, val+=m_MajorIncX) {
711 dc.DrawLine((int)x,(int)(m_Bottom+7+(7*MARGE/4)),(int)(x),(int)(m_Bottom+(7*MARGE/4)));
712 sprintf(text,"%g", val);
713 dc.GetTextExtent(wxString(text, wxConvUTF8),&widthx,&heighty);
714 dc.DrawText(wxString(text, wxConvUTF8), (int)(x-(widthx/2)) , (int)(y+3+heighty) );
719 dc.DrawLine(m_Right,m_Bottom+7+(7*MARGE/4),m_Right,m_Bottom+(7*MARGE/4));
720 sprintf(text,"%g", val);
721 dc.GetTextExtent(wxString(text, wxConvUTF8),&widthx,&heighty);
722 dc.DrawText(wxString(text, wxConvUTF8), (int)(m_Right-(widthx/2)), (int)(m_Right+3+heighty));
725 supx = st_decalage(m_MinorIncX, m_MinX) * m_StepSizeX;
727 for(y=m_Bottom,x=m_Left + supx; x <= m_Right; x+=minorIncStepX) {
728 dc.DrawLine((int)(x),(int)(m_Bottom+3+(7*MARGE/4)),(int)(x),(int)(m_Bottom+(7*MARGE/4)));
733 void wxChart::DrawAxePer(wxDC& dc)
740 double minorIncStepPer= MINOR_PER * m_StepSizePer;
741 double majorIncStepPer= MAJOR_PER * m_StepSizePer;
743 dc.SetPen(*wxBLACK_PEN);
744 dc.SetBrush(*wxBLACK_BRUSH);
747 dc.DrawLine((int)(m_Right+(7*MARGE/4)) , m_Bottom, (int)(m_Right+(7*MARGE/4)), m_Top);
749 // Major Tick Marks with values
751 for(x=m_Right,y=m_Bottom; y >= m_Top; y-=majorIncStepPer, val+=MAJOR_PER) {
752 dc.DrawLine( (int)(m_Right+(7*MARGE/4)) , (int)y , (int)(m_Right+7+(7*MARGE/4)) , (int)(y) );
753 sprintf(text,"%g",(val-(MAX_PER/2)));
754 dc.GetTextExtent(wxString(text, wxConvUTF8),&widthx,&heighty);
755 dc.DrawText(wxString(text, wxConvUTF8) , (int)(m_Right+10+(7*MARGE/4)) , (int)(y-(heighty/2)) );
757 dc.DrawLine(m_Right+(7*MARGE/4),m_Top,m_Right+7+(7*MARGE/4),m_Top);
758 sprintf(text,"%g",(val-(MAX_PER/2)));
759 dc.GetTextExtent(wxString(text, wxConvUTF8),&widthx,&heighty);
760 dc.DrawText(wxString(text, wxConvUTF8),(int) (m_Right+10+(7*MARGE/4) ), (int) (m_Top-(heighty/2) ));
763 for(x=m_Right,y=m_Bottom; y >= m_Top; y-=minorIncStepPer) {
764 dc.DrawLine((int)(m_Right+(7*MARGE/4)),(int)y,(int)(m_Right+3+(7*MARGE/4)),(int)(y) );
769 void wxChart::DrawGrille(wxDC& dc)
773 double minorIncStepY = m_MinorIncY * m_StepSizeY;
774 double minorIncStepX = m_MinorIncX * m_StepSizeX;
776 dc.SetBrush(*wxLIGHT_GREY_BRUSH);
779 wxPen *Pen = new wxPen(*wxLIGHT_GREY, 1, wxDOT);
782 // quadrillage en point
784 for(x=m_Left,y=m_Bottom; y >= m_Top; y-=minorIncStepY)
785 dc.DrawLine((int)(m_Left-MARGE),(int)y,(int)(m_Right+MARGE),(int)y);
787 dc.DrawLine(m_Left-MARGE,m_Top,m_Right+MARGE,m_Top);
790 val = st_decalage(m_MinorIncX, m_MinX) * m_StepSizeX;
791 for(y=m_Bottom, x=m_Left + val ; x <= m_Right; x+=minorIncStepX)
792 dc.DrawLine((int)x,(int)(m_Bottom+MARGE),(int)x,(int)(m_Top-MARGE));
794 dc.DrawLine(m_Right,m_Bottom+MARGE,m_Right,m_Top-MARGE);
797 Pen->SetStyle(wxSOLID);
799 dc.DrawLine(m_Left-MARGE, m_Top-MARGE, m_Right+MARGE, m_Top-MARGE);
800 dc.DrawLine(m_Right+MARGE, m_Top-MARGE, m_Right+MARGE, m_Bottom+MARGE);
801 dc.DrawLine(m_Right+MARGE, m_Bottom+MARGE, m_Left-MARGE, m_Bottom+MARGE);
802 dc.DrawLine(m_Left-MARGE, m_Bottom+MARGE, m_Left-MARGE, m_Top-MARGE);
806 void wxChart::DrawLegend(wxDC& dc, int nbre)
812 int widthx, heighty, l_posx, l_posy;
814 int haut_ligne, compt = 0;
815 int l_haut = m_BottomLegend - m_TopLegend;
816 int l_larg = m_RightLegend - m_LeftLegend;
818 div_t result = div(nbre,2);
820 int l_debut = 30, l_trait = 15, l_space = 10;
823 haut_ligne = l_haut / result.quot;
825 haut_ligne = l_haut / (result.quot+1);
828 dc.SetPen(*wxBLACK_PEN);
829 dc.SetBrush(*wxBLACK_BRUSH);
830 dc.DrawLine(m_LeftLegend, m_TopLegend, m_RightLegend, m_TopLegend);
831 dc.DrawLine(m_RightLegend, m_TopLegend, m_RightLegend, m_BottomLegend);
832 dc.DrawLine(m_RightLegend, m_BottomLegend, m_LeftLegend, m_BottomLegend);
833 dc.DrawLine(m_LeftLegend, m_BottomLegend, m_LeftLegend, m_TopLegend);
836 int maxdataset = GetNumDataSet();
837 for (int a=0; a < maxdataset; a++) {
838 if (m_dataSetArray[a] && m_dataSetArray[a]->GetShow()) {
841 string = m_dataSetArray[a]->GetText();
842 sprintf(text,"%s",string);
843 dc.GetTextExtent(wxString(text, wxConvUTF8),&widthx,&heighty);
844 resulta = div(compt, 2);
845 l_posx = m_LeftLegend;
846 l_posy = m_TopLegend;
847 if (resulta.rem == 0) {
849 l_posy+= (haut_ligne * resulta.quot);
852 l_posy+= (haut_ligne * (resulta.quot+1));
853 l_posy-= (haut_ligne/2);
857 l_posx = m_LeftLegend + ((l_larg - l_trait - l_space - widthx)/2) - l_debut;
860 dataBrush = m_dataSetArray[a]->GetDataStyle();
861 dataPen = m_dataSetArray[a]->GetLineStyle();
862 dataPen->SetWidth(2);
863 dc.SetBrush(*dataBrush);
865 dc.DrawLine(l_posx + l_debut, l_posy, l_posx + l_debut + 15, l_posy);
866 dataPen->SetWidth(1);
869 dc.SetFont(*(new wxFont(1, wxDEFAULT, wxNORMAL, wxBOLD)));
870 dc.SetPen(*wxBLACK_PEN);
871 dc.SetBrush(*wxBLACK_BRUSH);
872 dc.DrawText(wxString(text, wxConvUTF8),l_posx + l_debut + l_trait + l_space ,l_posy - (heighty/2));
873 dc.SetFont(*(new wxFont(1, wxDEFAULT, wxNORMAL, wxLIGHT)));
879 void wxChart::DrawLine(wxDC &dc, int a)
883 double mid = m_Bottom - ((m_Bottom-m_Top)/2);
884 int maxitem = GetNumItem();
889 for(int j=0; j < maxitem; j++) {
890 if ( IsEmpty(a,j) == false ) {
892 xsuiv = m_Left + ((GetDataX(a,j) - m_MinX ) * m_StepSizeX);
894 if ( a == wxStenosis)
895 // Axe Per for Stenosis
896 ysuiv = mid - (val * m_StepSizePer);
899 ysuiv = m_Bottom - (val * m_StepSizeY);
903 dc.DrawLine((int)xprec, (int)yprec, (int)xsuiv, (int)ysuiv);
914 //-----------------------------------------------------------------
915 void wxChart::OnLeftClick(wxDC &dc, double x, double y, int keys)
920 void wxChart::OnRightClick(wxDC &dc, double x, double y, int keys)
927 //--------------------------------------------------------------------
928 void wxChart::InitData()
931 for(int a=0; a<MAX_DATASET; a++) {
932 for(int j=0; j<MAX_ITEM; j++) {
933 m_table[a][j].x=0.00;
934 m_table[a][j].y=0.00;
935 m_table[a][j].empty = true;
940 bool wxChart::IsEmpty(int a, int j)
942 return m_table[a][j].empty;
946 double wxChart::GetDataX(int a, int j)
948 return m_table[a][j].x;
951 double wxChart::GetDataY(int a, int j)
953 return m_table[a][j].y;
957 void wxChart::SetData(int a, int j, double x, double y)
961 m_table[a][j].empty = false;
965 void wxChart::ShowDataSet(bool show,int dataset)
967 if(m_dataSetArray[dataset])
968 m_dataSetArray[dataset]->Show(show);
971 bool wxChart::GetShowDataSet(int dataset)
973 if(m_dataSetArray[dataset])
974 return m_dataSetArray[dataset]->GetShow();