User (Legacy) Posted September 2, 1999 Report Share Posted September 2, 1999 Hello, I am no expert with this, but I looked at it and saw that the problem seems to be with your use of the OpenDataEx. The way the code looks (without a call to MultipleColors property), you are only affecting the series objects. If you change the > for(i=0; i<50; i++) > { > if (i<25) > m_pChartFX->Color[i] = RGB(255,0,0); > else > m_pChartFX->Color[i] = RGB(0,0,255); > > } to > for(i=0; i<50; i++) > { > if (i<1) > m_pChartFX->Color[i] = RGB(255,0,0); > else > m_pChartFX->Color[i] = RGB(0,0,255); > > } you will see what I mean. It will change the second series to RGB(0, 0, 255). On the other hand, if you set MultipleColors to true, then the OpenDataEx(COD_COLORS, n, 0) will open the chart with 'n' being the number of points you have. You can create neat things like Christmas Tree Charts (see code below). I doubt this is the correct way to do this, but I thought you might be interested in it. Sorry I couldn't be more help (I tried something like this when I first began to play with Chart FX. I wanted to highlight the points the user selected, but it didn't work as well as I wanted). -- Josh Eanes int i; //////////////////////////////////////////////////////////////////////////// //// // load each data points with X,Y values //////////////////////////////////////////////////////////////////////////// //// m_pChartFX->put_MultipleColors(TRUE); m_pChartFX->OpenDataEx(COD_XVALUES, 2, 50); for(i=0; i<50; i++) { m_pChartFX->ValueEx[0][i] = i; m_pChartFX->XValueEx[0][i] = i; m_pChartFX->ValueEx[1][i] = 2*i; m_pChartFX->XValueEx[1][i] = i; } m_pChartFX->CloseData(COD_XVALUES); //////////////////////////////////////////////////////////////////////////// //// // set colors for each data point //////////////////////////////////////////////////////////////////////////// //// m_pChartFX->MultipleColors = true; m_pChartFX->OpenDataEx(COD_COLORS, 8, 0); for(i=0; i<8; i++) { // create christmas tree effect- works much better on a series with base color transparent if (i == 0) m_pChartFX->put_Color(i, RGB(255,0,0)); if (i == 1) m_pChartFX->put_Color(i, RGB(0,0,255)); if (i == 2) m_pChartFX->put_Color(i, RGB(0,255,0)); if (i == 3) m_pChartFX->put_Color(i, RGB(0,0,0)); if (i == 4) m_pChartFX->put_Color(i, RGB(255,255,255)); if (i == 5) m_pChartFX->put_Color(i, RGB(120,120,120)); if (i == 6) m_pChartFX->put_Color(i, RGB(120,255,0)); if (i == 7) m_pChartFX->put_Color(i, RGB(125,125,255)); } m_pChartFX->CloseData(COD_COLORS); anonymous <anonymous@email.net> wrote in message news:DE0379D14694D211B4CE00609770710D035215@sftfx-221.wamnet.net... > I'm using an XY chart and would like to have one series with 2 different > colors. I followed the book example (p78) and it still doesnt work. Any > ideas? > > my code: > int i; > //////////////////////////////////////////////////////////////////////////// > //// > // load each data points with X,Y values > //////////////////////////////////////////////////////////////////////////// > //// > m_pChartFX->OpenDataEx(COD_XVALUES, 2, 50); > for(i=0; i<50; i++) > { > m_pChartFX->ValueEx[0][i] = i*i; > m_pChartFX->XValueEx[0][i] = i; > > m_pChartFX->ValueEx[1][i] = 2*i*i; > m_pChartFX->XValueEx[1][i] = i; > > } > m_pChartFX->CloseData(COD_XVALUES); > > > //////////////////////////////////////////////////////////////////////////// > //// > // set colors for each data point > //////////////////////////////////////////////////////////////////////////// > //// > m_pChartFX->MultipleColors = true; > m_pChartFX->OpenDataEx(COD_COLORS, 2, 0); > > for(i=0; i<50; i++) > { > if (i<25) > m_pChartFX->Color[i] = RGB(255,0,0); > else > m_pChartFX->Color[i] = RGB(0,0,255); > > } > m_pChartFX->CloseData(COD_COLORS); > > > Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.