c# - TeeChart RedCross Error Continued -
this post corresponds answer on previous post...
before upload simple project you, let me try else: noticed when swap points series colorgrid series same thing happens, but, when (with colorgrid series) use "mycolorgrid.yvalues[gridposition] = val" instead of mycolorgrid.add(x, y, z) works. there way can use points series in same way, ie, allocate points first time, , use xvalues[idx] = x, , yvalues[idx] = y update points? problem seems happen when use add method, clear method. when update values xvalues , yvalues etc. problem seems solved! thing is, can not work on points series...it easy colorgrid series:
(int r = 0; r < 128; r++) { (int d = 0; d < 128; d++) { mycolorgrid.yvalues[d * 128 + r] = some_value; } } mycolorgrid.beginupdate(); mycolorgrid.endupdate();
question 1: how achieve same points series? question 2: if succeed, how clear/delete points, without again having "add(x, y)" them afterwards? question 3: best way use beginupdate/endupdate? whats difference? in general, differences between available update methods, , how choose correct one? few examples:
mycolorgrid.refreshseries mycolorgrid.repaint mytchart.refresh mytchart.autorepaint
regards
jd
question 1: how achieve same points series?
i suggest use similar code next works in correct way when update points.
steema.teechart.styles.points points1; steema.teechart.tchart tchart1; random rnd; public form1() { initializecomponent(); tchart1 = new steema.teechart.tchart(); this.controls.add(tchart1); tchart1.aspect.view3d = false; tchart1.height = 400; tchart1.width = 500; tchart1.dock = dockstyle.bottom; points1 = new steema.teechart.styles.points(tchart1.chart); rnd = new random(); initializechart(); } private void initializechart() { (int = 0; < 128; i++) { points1.add(i, rnd.next(100)); } tchart1.refresh(); } private void button1_click(object sender, eventargs e) { (int = 0; < 128; i++) { points1.xvalues[i] = i+1; points1.yvalues[i] = rnd.next(100); } points1.beginupdate(); points1.endupdate(); }
question 2: if succeed, how clear/delete points, without again having "add(x, y)" them afterwards?
i suggest use method setnull() make null point don't want. can same next line of code:
points1.setnull(3);
question 3: best way use beginupdate/endupdate? whats difference? in general, differences between available update methods, , how choose correct one? few examples:
about beginupdate/endupdate:
the beginupdate method recalculates function 1 time, when finished adding points , endupdate method necessary used .beginupdate recalculate function once when finished adding points. therefore, must use both methods when decide use beginupdate update series.
about other methods:
the differences between methods explained definition found in documentation , can see in next lines:
series.refreshseries: refreshseries method notifies dependent series recalculate points again. each series has datasource property. when datasource valid series or dataset component, series point values datasource , adds them series points. refreshseries method forces series clear , points again datasource component. refreshing process traverses series tree recursively
series.repaint: series method forces whole parent chart repaint. don't call repaint directly. can used within derived tchartseries components when changing properties internally .
tchart.refresh: forces control invalidate client area , redraw , child controls.
tchart.autorepaint: use autorepaint false disable chart repainting whilst (for example) adding large number of points chart series. avoids repainting of chart whilst points added. autorepaint may re-enabled, followed manual repaint command when points added.
i hope helps. if have questions please let me know.
thanks,