ILineSeries.ColorEachLine inconsistency
Posted: Fri Feb 17, 2006 2:57 am
There is a possible inconsistency in the logic of ILineSeries.ColorEachLine flag.
It doesn't do anything if ISeries.ColorEachPoint is "false". Please refer sample code and it's comments for all four combination of these parameters.
It doesn't do anything if ISeries.ColorEachPoint is "false". Please refer sample code and it's comments for all four combination of these parameters.
Code: Select all
static void Main(string[] args)
{
ITChart pChart = new TChartClass();
pChart.SetTheme(EChartTheme.ctExcel, EColorPalette.cpExcel); // just to make chart look nicer
pChart.Aspect.View3D = false;
int idx = pChart.AddSeries(ESeriesClass.scLine);
ISeries pSeries = pChart.Series(idx);
ILineSeries pAreaSeries = (ILineSeries)pSeries.asLine;
pAreaSeries.Pointer.Visible = true;
pAreaSeries.Pointer.Style = EPointerStyle.psDiamond;
pAreaSeries.Pointer.HorizontalSize = 4;
pAreaSeries.Pointer.VerticalSize = 4;
// add data
for (int i = 0; i < 7; i++)
pSeries.AddXY(i, i, null, (uint)EConstants.clTeeColor);
// export graph to observe the problem
IBMPExport pBMP = pChart.Export.asBMP;
pBMP.Height = 250;
pBMP.Width = 600;
// set one of series data colors to user defined color
pSeries.set_PointColor(1,0xff); //red
// uses default color to draw points (except point color for point 1)
// and default color for line segments
pSeries.ColorEachPoint = false;
pAreaSeries.ColorEachLine = false;
pBMP.SaveToFile("c:\\tee_1_CEPointFalse_CELineFalse.bmp");
// uses palette colors to draw points (except point color for point 1)
// and default color for line segments
pSeries.ColorEachPoint = true;
pAreaSeries.ColorEachLine = false;
pBMP.SaveToFile("c:\\tee_2_CEPointTrue_CELineFalse.bmp");
// uses palette colors to draw points(except point color for point 1)
// DOES IT USE palette colors for line segments(except point color for line segment 1)
// OR same colors as points do?
pSeries.ColorEachPoint = true;
pAreaSeries.ColorEachLine = true;
pBMP.SaveToFile("c:\\tee_3_CEPointTrue_CELineTrue.bmp");
// uses default color to draw points(except point color for point 1)
// and default color for line segments
// BUT SHALL IT USE palette colors for line segments(except point color for line segment 1)?
// OR same colors as points do?
// JUST LIKE in case 3?
pSeries.ColorEachPoint = false;
pAreaSeries.ColorEachLine = true; //<<<< produces the same picture as in case 1 "tee_1_CEPointFalse_CELineFalse"
pBMP.SaveToFile("c:\\tee_4_CEPointFalse_CELineTrue.bmp");
}