horizontal pareto chart

TeeChart for Java (NetBeans, Eclipse, Android Studio, etc)
Post Reply
Jonathan
Newbie
Newbie
Posts: 60
Joined: Tue Mar 11, 2008 12:00 am
Location: Austin

horizontal pareto chart

Post by Jonathan » Wed Jan 04, 2012 10:48 pm

Hi
I have a vertical pareto chart by using bar teechart object. If I want to see it as horizontal pareto chart, how can I do that? Is it possible to rotate the axis such that bottom axis become a left axis, and the left axis becomes a top axis?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: horizontal pareto chart

Post by Narcís » Thu Jan 05, 2012 8:19 am

Hi Jonathan,

No, you should use HorizBar series instead of Bar series. Do the same you already do with Bar but using HorizBar.

Hope this helps!
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Jonathan
Newbie
Newbie
Posts: 60
Joined: Tue Mar 11, 2008 12:00 am
Location: Austin

Re: horizontal pareto chart

Post by Jonathan » Thu Jan 05, 2012 4:05 pm

Hi,

Yes, it helps. thanks for the help.

I have two more questions.

Question1)
When I use HorizBar, I noticed that x axis on the bottom by default. Is it possible to have it to the top axis instead?

Question2)
When I re-label on the left axis, it also replace the markers. How can I prevent it? I tried using the setLabels built-in function to replace the markers, but it also replaces the labels as well. The following is a sample.

Code: Select all

package com.amd.ngeda.chart.teechart;

import java.util.HashMap;
import java.util.Map;

import javax.swing.JFrame;
import javax.swing.JPanel;

import com.steema.teechart.TChart;
import com.steema.teechart.drawing.Color;
import com.steema.teechart.styles.Bar;
import com.steema.teechart.styles.Box;
import com.steema.teechart.styles.HorizBar;
import com.steema.teechart.styles.Line;
import com.steema.teechart.styles.StringList;

public class JonathanTest {
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		JFrame frame = new JFrame();
		JPanel panel = new JPanel();
		panel.setSize(600, 600);
		TChart chart = new TChart();
		panel.add(chart);
		
		HorizBar b = new HorizBar(chart.getChart());
		b.add(1, 0, "A");
		b.add(2, 1, "B");
//		StringList labelsList =  new StringList(2);
//		labelsList.add(0, "1");
//		labelsList.add(1, "2");
//		b.setLabels(labelsList);
		
		frame.add(panel);
		frame.setSize(600, 600);
		frame.setVisible(true);
	}
}


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

Re: horizontal pareto chart

Post by Yeray » Mon Jan 09, 2012 8:34 am

Hi Jonathan,
Jonathan wrote:Question1)
When I use HorizBar, I noticed that x axis on the bottom by default. Is it possible to have it to the top axis instead?
Yes, you can do it as follows:

Code: Select all

b.setHorizontalAxis(HorizontalAxis.TOP);
Jonathan wrote:Question2)
When I re-label on the left axis, it also replace the markers. How can I prevent it? I tried using the setLabels built-in function to replace the markers, but it also replaces the labels as well. The following is a sample.
If your series (b in your case) has values with texts/labels, the axis linked to it shows these texts by default. And changing the series strings affects both the series marks and the axis labels.
You have two options:
- Change axis style to VALUE in example:

Code: Select all

tChart1.getAxes().getLeft().getLabels().setStyle(AxisLabelStyle.VALUE);
- Custom Labels: Clear and set the axis labels manually:

Code: Select all

	      AxisLabelsItems LeftAxisLabels = tChart1.getAxes().getLeft().getLabels().getItems();
	      LeftAxisLabels.clear();
	      LeftAxisLabels.add(0.0, "1");
	      LeftAxisLabels.add(1.0, "2");
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

Jonathan
Newbie
Newbie
Posts: 60
Joined: Tue Mar 11, 2008 12:00 am
Location: Austin

Re: horizontal pareto chart

Post by Jonathan » Mon Jan 09, 2012 4:58 pm

Hi Yeray,

Thanks for the help and answering my questions.

Post Reply