getImageMode() never called!

TeeChart for Java (NetBeans, Eclipse, Android Studio, etc)
Post Reply
znakeeye
Newbie
Newbie
Posts: 44
Joined: Mon Jan 07, 2013 12:00 am

getImageMode() never called!

Post by znakeeye » Sat Mar 23, 2013 12:31 pm

So how would you get a tiled/centered image on the panel/wall?

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

Re: getImageMode() never called!

Post by Yeray » Mon Mar 25, 2013 4:49 pm

Hi Kristoffer,
getImageMode() never called!
It's a public function you can use to check the value of the imageMode property. Internally, it is directly used the imageMode property in the

Code: Select all

chartEvent
.
znakeeye wrote:So how would you get a tiled/centered image on the panel/wall?
Here you have an example of how to use the CENTER mode:

Code: Select all

	private void initializeChart() {
		tChart1.getAspect().setView3D(false);
		tChart1.getLegend().setVisible(false);
		  
		Bar bar1 = new Bar(tChart1.getChart());
		bar1.fillSampleValues();
		
		checkExternalStorage();

		Image im = null;
		if (mExternalStorageAvailable) {
			if (mExternalStorageWriteable) {
				final File ExtPath = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + "Download");
				ExtPath.mkdirs();
				String path = ExtPath.getAbsolutePath() + File.separator + "flower.jpg";
				im = new Image(path);		        
			}
		}
		
		ChartImage chIm = new ChartImage(tChart1.getChart());
		chIm.setImage(im);
		chIm.setImageMode(ImageMode.TILE);
		//chIm.setImageMode(ImageMode.CENTER);
	}

	private boolean mExternalStorageAvailable = false;
	private boolean mExternalStorageWriteable = false;
	private void checkExternalStorage() {
		final String state = Environment.getExternalStorageState();

		if (Environment.MEDIA_MOUNTED.equals(state) || Environment.MEDIA_SHARED.equals(state)) {
			// We can read and write the media
			mExternalStorageAvailable = mExternalStorageWriteable = true;
		} else if (Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) {
			// We can only read the media
			mExternalStorageAvailable = true;
			mExternalStorageWriteable = false;
		} else {
			// Something else is wrong. It may be one of many other states, but
			// all we need
			// to know is we can neither read nor write
			mExternalStorageAvailable = mExternalStorageWriteable = false;
		}
	}
center.png
center.png (16.5 KiB) Viewed 8096 times
However, I'm afraid the TILE and STRETCH modes aren't implemented yet. I've added it to the wish list to be implemented in next releases (TJ71016548).
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