Page 1 of 1

How to immediately redraw chart after series changed?

Posted: Wed Jun 24, 2015 9:48 am
by 17073287
Hi,

I'm using Teechart Java for Android.

There's a case in my app when I need to remove all bars from my chart and display a message instead.

To achieve the described behavior, I use the following steps:
1. I call

Code: Select all

series.clear()
to remove all bars from my chart.
2. I have a ChartPaintAdapter, and in chartPainted() method I use IGraphics3D to draw a message.

The question is that there's a time lag between bars removed and my message is shown. During this lag for some period of time I see just a blank chart with no data and with no message. Only after a second or two the message is shown.
Is it possible to draw a message immediately after series is cleared? How to achieve that?

Re: How to immediately redraw chart after series changed?

Posted: Thu Jun 25, 2015 11:12 am
by yeray
Hi Dennis,

I don't see any delay with the following simple example, neither drawing text at chartPainted, or with a Toast:

Code: Select all

        tChart1.getAspect().setView3D(false);
        tChart1.getHeader().setVisible(false);
        tChart1.getLegend().setVisible(false);
        
        Bar bar1 = new Bar(tChart1.getChart());
        bar1.fillSampleValues();
        
        Bar bar2 = new Bar(tChart1.getChart());
        bar2.fillSampleValues();

		final ChartPaintAdapter cpa = new ChartPaintAdapter() {
			
			@Override
			public void chartPainted(ChartDrawEvent e) {
				if (tChart1.getSeriesCount() == 0) {
					tChart1.getGraphics3D().textOut(50, 50, "Bars cleared");
				}
			}
		};
		
		tChart1.addChartMouseListener(new ChartMouseAdapter() {
			
			@Override
			public void backgroundClicked(ChartMouseEvent e) {
				tChart1.getSeries().clear();
				
				Toast.makeText(getApplicationContext(), "Bars cleared",
						   Toast.LENGTH_LONG).show();
				
				tChart1.addChartPaintListener(cpa);
			}
		});

Re: How to immediately redraw chart after series changed?

Posted: Thu Jun 25, 2015 12:25 pm
by 17073287
Dear Yeray,

please see an e-mail from me.