ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  ZoomScrollTrack2 setting value for loadData from another class
Posted by jill on Aug-23-2019 16:20
In MainWindow I have some pushbutton when I click them
They Selects values from the database, I want to set those values for m_dataSeriesA, m_dataSeriesB, m_dataSeriesC.
So after creating the pointer from
ZT = new ZoomScrollTrack2 ();
I'm calling  ZT-> loadData (rows [0]). Instead of calling it the ZoomScrollTrack2 constructor

But the program crashed, what should I do to set values from another class?

  Re: ZoomScrollTrack2 setting value for loadData from another class
Posted by Peter Kwan on Aug-23-2019 21:57
Hi Jill,

From your message, it seems you are referring to the Qt demo code in ChartDirector for C++. Would you to clarify how the code is modified for your case?

In the original sample code, the last few lines in the constructor is like:

    // Load the data
    loadData();

    // Initialize the QChartViewer
    initChartViewer(m_ChartViewer);

    // Initially set the mouse to drag to scroll mode
    pointerPB->click();

    // Trigger the ViewPortChanged event to draw the chart
    m_ChartViewer->updateViewPort(true, true);


Please note:

(a) If you remove "loadData();", you must also remove the initChartViewer and updateViewPort lines, because the latter two lines requires the data.

(b) When you look at the loadData function, it initializes a m_ranSeries variable. If you do not call "loadData" in the constructor, your code must add code to initialize the member variables to valid values in the constructor, like "m_ranSeries = 0;". If you do not use the RanSeries in your test code, the m_ranSeries variable in not necessary, and you can remove it entirely.

(c) After your code calls the loadData function later, please remember to call the "initChartViewer" and "updateViewPort" as well.

(d) The "drawChart" routine uses the data to draw the chart. The chart will be updated when the user moves the scrollbar or change the date/time controls. If the data has not been loaded, and the user drags the scrollbar, the "drawChart" will try to update the chart and may crash as there is no data. Please add the following line at the beginning to disable it from drawing then chart when there is no data.

    if (m_timeStamps.len == 0)
        return;

Hope this can help.

Regards
Peter Kwan


cix porn hard porn kostenlose porn amateur xxx love porn amateur sex hd porn free 3 xxx moblie porn