I have a bar graph. What I tried to accomplish is to show the labels only for the max and min value and hide the labels in-between. Please have a look at the following diagrams.

figure1. when a chart is created from the data.

figure2. when the chart is exported to a meta-file.
I also attach the sample of my code.
Code: Select all
void CTChart::OnGetSeriesMark(long SeriesIndex, long ValueIndex, BSTR FAR* MarkText)
{
if ( showmode == 1 ) {
double maxVal = Series(SeriesIndex).GetYValues().GetMaximum();
double minVal = Series(SeriesIndex).GetYValues().GetMinimum();
char maxBuf[50];
char minBuf[50];
//sprintf(maxBuf, "%f", maxVal);
//sprintf(minBuf, "%f", minVal);
_gcvt( maxVal, 10, maxBuf );
_gcvt( minVal, 10, minBuf );
CString tmpStr = _T("");
tmpStr = *MarkText;
CComBSTR tmpBSTR = tmpStr;
double markVal = atof(tmpStr);
CComBSTR emptyStr = _T("");
*MarkText = emptyStr.Copy();
CString str = _T("");
int len;
if ( markVal == maxVal )
{
len = strlen(maxBuf)-1;
str = maxBuf[len];
if(str == _T("."))
maxBuf[len] = '\0';
tmpBSTR = maxBuf;
*MarkText = tmpBSTR.Copy();
}
if ( markVal == minVal )
{
len = strlen(minBuf)-1;
str = minBuf[len];
if(str == _T("."))
minBuf[len] = '\0';
tmpBSTR = minBuf;
*MarkText = tmpBSTR.Copy();
}
}
else if ( showmode == 2 ) {
CString sName = _T("");
sName = Series(SeriesIndex).GetTitle();
CComBSTR tmpBSTR = sName;
*MarkText = tmpBSTR.Copy();
}
}
Tee-chart Version 6 (6006)
Many thanks.