Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
710
CharDrawItem Event
posted

I am trying to use the ChartDrawItem event. I put a Consule.WriteLine() to see when it's called. I realize as long my ultrachart is open, it keeps looping in it. Is this suppose to be like that? I simply want to make use of the Primivitive to change color of my 3D chart. I only need to run one time when I load the ultraChart.

Does anyone know why it goes infinite loop in ChartDrawItem? 

if

 

(e.HasData && this.ultraChart1.ChartType == ChartType.HeatMapChart3D)

{

 

Path p = e.Primitive as Path;

 

if (e.Primitive.Row != -1)

{

 

DataTable dt = (DataTable)(this.ultraChart1.DataSource);

 

int division = dt.Rows.Count / 4;

 

if (e.Primitive.Row < division)

{

 

SolidBrush sb = new SolidBrush(ultraColorPicker1.Color);

p.Brush = sb;

p.PE.Stroke = ultraColorPicker1.Color;

}

 

else if (e.Primitive.Row < division * 2)

{

 

SolidBrush sb = new SolidBrush(ultraColorPicker2.Color);

p.Brush = sb;

p.PE.Stroke = ultraColorPicker2.Color;

}

 

else if (e.Primitive.Row < division * 3)

{

 

SolidBrush sb = new SolidBrush(ultraColorPicker3.Color);

p.Brush = sb;

p.PE.Stroke = ultraColorPicker3.Color;

}

 

else if (e.Primitive.Row == dt.Rows.Count - 1)

{

 

SolidBrush sb = new SolidBrush(ultraColorPicker4.Color);

p.Brush = sb;

p.PE.Stroke = ultraColorPicker4.Color;

 

}

 

else

{

 

SolidBrush sb = new SolidBrush(ultraColorPicker4.Color);

p.Brush = sb;

p.PE.Stroke = ultraColorPicker4.Color;

}

 

}

 

 

ultraChart1.ColorModel.Skin.ApplyRowWise =

true;

}

 

 

 

 

 

 

 

 p.Brush = Color.Red;