Jump to content
Software FX Community

Re: Please Help !!!


User (Legacy)

Recommended Posts

Serge,

(I always get lost in the C++ code!)

"If (nSeries == 0 || nPoints == 0)"

If is True, can't you fill the chart with 1 series 1 or more points but use CHART_HIDDEN for the value to create an "empty" chart but one that perhaps will not "blow up"?

In vb:

ChartFX1.OpenDataEx COD_VALUES, 1, 1

ChartFX1.ValueEx(0, 0) = CHART_HIDDEN

ChartFX1.CloseData COD_VALUES

Steve

Serge S. Spiridonoff <sss@corbina.net> wrote in message news:0iYagCKkAHA.1808@sfxserver.softwarefx.com...

> Hi!

>

> The application I'm working on can extract data from different sources (like

> databases or text files) and then plot specified (by the user) columns and

> records on charts. Then, the charts may be printed.

>

> Such operations may be automated by running the app by a scheduler. But this

> means that the source data may vary between runs. Particularly, the source

> DB may have no records or the source file become empty (no columns).

>

> In such a case the app have to display an empty chart, either a chart with

> non-zero number of series and zero number of points or a chart with "no data

> available" text only.

>

> To achieve this, I do the following.

>

> // create the chart control

> ...CreateInstanceLic(...&m_pChartFX);

> ...

>

> // clear series legend

> m_pChartFX->ClearLegend((CfxLegend)CHART_SERLEG);

>

> if (nSeries == 0 || nPoints == 0)

> {

> // empty chart

> m_pChartFX->ClearData(CfxDataMask(CD_VALUES|CD_XVALUES));

>

> m_pChartFX->LegendBox = AFX_OLE_FALSE;

>

> return;

> }

>

> // pass extracted data to the chart

> ...

>

> then I create and show a chart window, if it is not already created

>

> m_pChartFX->CreateWnd(...);

>

> And this is the point where the Chart FX library crashes with a Divide by

> Zero exception.

>

>

> I've posted the sample MFC application (see ChartFX crash post) but nobody

> (especially tech. support) replied.

>

> Not hoping to get a reply from the tech support any more, at least, could

> somebody please suggest something to change (or add) in the code to work

> around the crash.

>

> Please note that I can't just do nothing (i.e. CreateInstanceLic followed by

> immediate CreateWnd) because the application allows users to re-extract

> data. That is, a user may extract data and create a chart from them

> (non-zero number of points and series at this time). And then, after some

> period of time, he/she may request the app to re-extract data and update the

> chart. But at this time the data source may change to contain no records, so

> the app will have to "clear" the chart somehow.

>

> Thanks in advance,

> Serge

>

>

>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...