i have following setup:
a teechart control colorgrid, , points series added it:
grid = tchart2.series[0] steema.teechart.styles.colorgrid; points = tchart2.series[1] steema.teechart.styles.points;
to init them, do:
random rnd = new random(); (int = 0; < 128; i++) { (int j = 0; j < 128; j++) { grid.add(j, rnd.next(255), i); } } (int = 0; < 20; i++) { double x = rnd.next(); double y = rnd.next(); points.add(x, y); } tchart2.refresh();
and have button on form:
private void button1_click(object sender, eventargs e) { random rnd = new random(); (int = 0; < 128; i++) { (int j = 0; j < 128; j++) { grid.yvalues[j + 128 * i] = rnd.next(255); } } (int = 0; < 20; i++) { points.setnull(i); } (int = 0; < rnd.next(20); i++) { points.xvalues[i] = rnd.next(128); points.yvalues[i] = rnd.next(128); } points.beginupdate(); points.endupdate(); }
but points not drawn. when remove for-loop containing setnull() statement, drawn, want able clear points (or hide points don't want seen) without using points.clear()/points.add(x, y) methodology.
i've tried each of following, there's no difference.
points.treatnulls = steema.teechart.styles.treatnullsstyle.donotpaint; points.treatnulls = steema.teechart.styles.treatnullsstyle.ignore; points.treatnulls = steema.teechart.styles.treatnullsstyle.skip;
does know how accomplish this?
ok, problem caused when set null of points. must know if use method setnull point color set transparent make invisible point. therefore, if want solve problem need reset colors of points want visible, doing setnull again or change points color manually , combining operation treatnullsstyle set ignore. in opinion, think best option use setnull again in next code:
public form1() { initializecomponent(); initializechart(); } steema.teechart.styles.colorgrid grid; steema.teechart.styles.points points; private void initializechart() { grid = new colorgrid(tchart1.chart); points = new points(tchart1.chart); tchart1.aspect.view3d = false; random rnd = new random(); (int = 0; < 128; i++) { (int j = 0; j < 128; j++) { grid.add(i, rnd.next(255), j); } } (int = 0; < 20; i++) { double x = rnd.next(100); double y = rnd.next(100); points.add(x, y); } } private void button1_click(object sender, eventargs e) { random rnd = new random(); (int = 0; < 128; i++) { (int j = 0; j < 128; j++) { grid.yvalues[j + 128 * i] = rnd.next(255); } } (int = 0; < 20; i++) { points.setnull(i); } (int = 0; < rnd.next(20); i++) { points.xvalues[i] = rnd.next(128); points.yvalues[i] = rnd.next(128); points.setnull(i, false); } points.treatnulls = treatnullsstyle.ignore; }
could tell if previous code works in correct way you?
i hope helps.
thanks,
Comments
Post a Comment