wxFreeChart Program Stops Responding Topic is solved

Talk here about issues with one of the components hosted at wxCode, or suggest features for it.
Post Reply
medusa1414
In need of some credit
In need of some credit
Posts: 7
Joined: Wed Mar 18, 2015 3:19 pm

wxFreeChart Program Stops Responding

Post by medusa1414 »

Hello. I Try to update data in a XY chart.
The program freezes/stops responding when i click the update button. Same with debug version, no error messages.

The chart itself looks like this when i try to update it:
Image

If have tried all of these methods:

Code: Select all

void graph::getGraphDataUpdate(wxString dateString)
{
    serie->UpdateX(5, -5);
    dataset->DatasetChanged();
}

Code: Select all

void graph::getGraphDataUpdate(wxString dateString)
{
    dataset->BeginUpdate();
    serie->UpdateX(5, -5);
    dataset->EndUpdate();
}
Even this freezes the program:

Code: Select all

void graph::getGraphDataUpdate(wxString dateString)
{
    double f = serie->GetX(1);
    wxString tester;
    tester << f;
    wxMessageBox(tester, wxT("Nei"));
}
I have had a look at the XYdynamic data demo sample, there they use the first method i tried.

Can anyone help?
Ideally i want to clear the chart, then insert new data.
The chart will always have a X axis of 0-23. (representing hours on a 24 hour clock)
In worst case, I can loop through, and replace the Y values one by one when updating the data. But i cant get this to work, as mention above.

Full code:
https://pastebin.com/BXdrVzuB
https://pastebin.com/j8rdCFY2

wxFreeChart
https://github.com/iwbnwif/wxFreeChart
wxFreeChart doc
https://iwbnwif.github.io/freechart_doc ... index.html
medusa1414
In need of some credit
In need of some credit
Posts: 7
Joined: Wed Mar 18, 2015 3:19 pm

Re: wxFreeChart Program Stops Responding

Post by medusa1414 »

Okey, i have found out that there is no code existing for any of the delete functions in wxFreeChart, the functions is only declared in the headers.
I ended up rewriting my code and use the wxChartPanel->SetChart function on update instead.

Code: Select all

void mainFrame::updateData(wxCommandEvent& event)
{
    
    wxDateTime currentdate = wxDateTime::Now();
    wxDateTime date = setupDatePicker->GetDate();
    wxString str = date.FormatISODate();
    
    if(date.IsLaterThan(currentdate)) {
        wxMessageBox(wxT("Du kan ikke velge en dato frem i tid!"), wxT("Feil"), wxOK | wxICON_WARNING);
        return;
    }
    
    if(!date.IsValid()) {
        return;
    }
    
    graph ob;
    Chart* chartUpdated = ob.getGraph(str, false);
    
    chartPanel->SetChart(chartUpdated);
    
}
Post Reply