Android Chart two line series bug.

TeeChart for Java (NetBeans, Eclipse, Android Studio, etc)
Post Reply
Cameron
Newbie
Newbie
Posts: 5
Joined: Wed Feb 15, 2012 12:00 am

Android Chart two line series bug.

Post by Cameron » Mon Mar 05, 2012 3:20 pm

I have added a chart to a list view item. The strange thing is the scroll artifact that is created at the top and the bottom. I have tried changing a few things and determined that the second Line() added to the chart is the one that appears as the defect.

Code: Select all

public class TimeSeriesRollingIntradayGraph extends TChart {
	private IntradayTradeStorage mIntradayTradeStorage;
	private Line mSparkline;
	private Line mPreviousClose;
	
	public TimeSeriesRollingIntradayGraph(Context context, AttributeSet attributeSet) {
		super(context, attributeSet);
		
		this.getZoom().setAllow(false);
		this.getPanning().setAllow(ScrollMode.NONE);
		this.getPanel().setColor(Color.WHITE);
		this.getPanel().setBevelOuter(BevelStyle.NONE);	
		this.getPanel().setMarginLeft(0);
		this.getPanel().setMarginRight(0);
		this.getPanel().setMarginTop(0);
		this.getPanel().setMarginBottom(0);
		this.getPanel().setVisible(false);
				
		this.getAspect().setView3D(false);
		
	    this.getLegend().setVisible(false);
	    
	    this.getFooter().setVisible(false);
	    
	    this.getHeader().setVisible(false);
	    
	    this.getAxes().setVisible(false);
		this.getAxes().getBottom().setAutomaticMinimum(false);
		this.getAxes().getBottom().setAutomaticMaximum(false);
	    this.getAxes().getLeft().setMinimumOffset(2);
	    this.getAxes().getLeft().setMaximumOffset(2);
	    this.getAxes().getBottom().setMinimumOffset(2);
	    this.getAxes().getBottom().setMaximumOffset(2);
	    
	    Walls walls = this.getWalls();
	    walls.setVisible(false);
	    this.setWalls(walls);

	    this.mSparkline = new Line();
	    mSparkline.setColor(Color.DARK_GRAY);
		mSparkline.getLinePen().setWidth(2);
		this.addSeries(mSparkline);
	    
		DashStyle previousCloseLineStyle = DashStyle.DASH;
		previousCloseLineStyle.setDashWidth(3);
		this.mPreviousClose = new Line();
		mPreviousClose.setColor(Color.lightGray);
		mPreviousClose.getLinePen().setStyle(previousCloseLineStyle);
		mPreviousClose.getLinePen().setWidth(1);
		this.addSeries(mPreviousClose);
	}

	public IntradayTradeStorage getIntradayTradeStorage() {
		return mIntradayTradeStorage;
	}

	public void setIntradayTrades(IntradayTradeStorage anIntradayTradeStorage) {
		mSparkline.clear();
		this.mIntradayTradeStorage = anIntradayTradeStorage;

		if (anIntradayTradeStorage != null) {
			Instrument instrument = anIntradayTradeStorage.getInstrument();
			Feed feed = instrument.getFeed();
			Date exchangeStartTime = feed.getStartTime();
			Date exchangeEndTime = feed.getEndTime();
			if (exchangeStartTime != null && exchangeEndTime != null) {
				this.getAxes().getBottom().setMinimum(exchangeStartTime.getTime());
				this.getAxes().getBottom().setMaximum(exchangeEndTime.getTime());
			}

			for (IntradayTrade intradayTrade : anIntradayTradeStorage.getIntradayTrades()) {
				double x = intradayTrade.getDate().getTime();
				double y = intradayTrade.getLast().doubleValue();

				mSparkline.add(x, y);
			}
		}
	}

	public void setPreviousClose(Double previousClose) {
		mPreviousClose.clear();
		
		if (previousClose != null) {
			mPreviousClose.add(this.getAxes().getBottom().getMinimum(), previousClose.doubleValue());
			mPreviousClose.add(this.getAxes().getBottom().getMaximum(), previousClose.doubleValue());	
		}
	}
}
PreviousCloseDefect.png
Rendering issue
PreviousCloseDefect.png (58.98 KiB) Viewed 7967 times

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Android Chart two line series bug.

Post by Yeray » Wed Mar 07, 2012 12:45 pm

Hi Cameron,

I've been able to reproduce it so I've added it to the defect list to be revised in future releases (TJ71016072).
Thanks for reporting it.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply