-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stacked Column Chart redraws first chart #167
Comments
Hmm, it's not so easy say something specific without reproducible sample. Does the behaviour will the same if charts replace with wxPanel? |
Hi Kvaz1r , so it behaves like there is some sort of redraw event that occurs as soon as the cursor touches the stackedColumnChartCtrl. I don't think it's anything I added, I think it must be part of a default option. Possibly when the stackedColumnChartCtrl receives focus. I'm attaching my entire code so you can see what I've done. ` void AcornFrame::ChangeGraph()
wxWindow* ChartWindow = new wxWindow(Panel5,wxID_ANY,wxDefaultPosition, wxSize(1312,800));
if(boxcode== 1000 ) graphthis[i][j]= idbhtable[i][j] ;
// Add the first dataset
// Add the second dataset
// Create the legend widget
void AcornFrame::OnRadioBoxYearSelect(wxCommandEvent& event) } void AcornFrame::OnRadioBoxMetricsSelect(wxCommandEvent& event) } void AcornFrame::OnRadioBoxSpeciesSelect(wxCommandEvent& event) } void AcornFrame::OnRadioBoxOriginSelect(wxCommandEvent& event) } ` |
I only see that you at every call ChangeGraph() add new control to ChartWindow as a child and never remove any control from there. So just add stackedColumnChartCtrl and legendCtrl to fields of AcornFrame. And after updating value of pointer relayout frame. |
i've written a simpler program that exihbits the same behavior. You can select one of three table to graph and press the run button, the table will display. if you repeat the process and select another it will display until you move the cursor over the chartctrl window then it changes to which ever you first displayed. #include <wx/app.h> class newtestApp : public wxApp #endif // NEWTESTAPP_H ` class newtestFrame: public wxFrame
}; #endif // NEWTESTMAIN_H `#include "newtestApp.h" //(AppHeaders IMPLEMENT_APP(newtestApp); bool newtestApp::OnInit() }` newtestMain.cpp `/***************************************************************
#include "newtestMain.h" //(InternalHeaders(newtestFrame) //helper functions wxString wxbuildinfo(wxbuildinfoformat format)
#if defined(WXMSW) #if wxUSE_UNICODE
} //(IdInit(newtestFrame) BEGIN_EVENT_TABLE(newtestFrame,wxFrame) newtestFrame::newtestFrame(wxWindow* parent,wxWindowID id)
}
for(j=1;j<7;++j)
} double** newtestFrame::get_matrix_space(int m, int n)
} newtestFrame::~newtestFrame() void newtestFrame::OnQuit(wxCommandEvent& event) void newtestFrame::OnAbout(wxCommandEvent& event) |
Kvaz1r thanks for helping this novice wxWidgets struggle through this. Thanks for supporting the wxCharts library. I'm very happy with the quality of the charts. Removing the control and then creating a new one worked. One last question, is there anyway to convert the chart window to a bitmap so that it can be printed? I'm pretty sure the answer is no but I just thought I would ask. |
Right, this yet one thing that was implemented only for few charts.
into wxChartCtrl Another option - you can make screen of your application and save it in bitmap. If you also want save a legend it will be much easier. |
I've got 4 wxRadioButtonBoxes that control which of 67 tables get charted. When a change in selection in any of the 4 wxRadioButtonBoxes occurs, the function ChangeGraph() is called that selects which of the 67 tables gets charted. This all works well, the problem is that whenever I move the cursor over the StackedColumnChartCtrl it redraws the first chart that was drawn disregarding whatever chart was being displayed.
`void AcornFrame::ChangeGraph()
{
int i,j,boxcode,nrows,ncols;
int intyear = RadioBoxYear->GetSelection();
int intspecies = RadioBoxSpecies->GetSelection();
int intmetric = RadioBoxMetrics->GetSelection();
int intorigin = RadioBoxOrigin->GetSelection();
double **graphthis;
wxWindow* ChartWindow = new wxWindow(Panel5,wxID_ANY,wxDefaultPosition, wxSize(1312,800));
if(boxcode== 1000 ) graphthis[i][j]= idbhtable[i][j] ;
else if(boxcode== 1010 ) graphthis[i][j]= iBAtable[i][j] ;
else if(boxcode== 1020 ) graphthis[i][j]= iSTKtable[i][j] ;
else if(boxcode== 1100 ) graphthis[i][j]= idbhspeciestable[i][j] ;
.
,
,
}
}
CREATE LEGEND AND CHART DATA FROM graphthis
.
.
.
}
`
The text was updated successfully, but these errors were encountered: