Page 1 of 1

Marks not visible in special cases

Posted: Fri Nov 14, 2008 11:23 pm
by 7667591
Hi,

In some cases Marks are not visible for CustomBar.

Code: Select all

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

import com.steema.teechart.TChart;
import com.steema.teechart.styles.Bar;
import com.steema.teechart.styles.CustomBar;

public class Test {

   public static void main(String[] args) {
      JFrame frame = new JFrame();
      JPanel panel = new JPanel();
      panel.setSize(600, 600);
      TChart chart = new TChart();
      chart.getAxes().getLeft().getTitle().setText("Help Needed");
      chart.getAxes().getLeft().setMinMax(0,50);
      panel.add(chart);
      CustomBar pareto = new Bar(chart.getChart());
      pareto.add(50, "a");
      pareto.add(50, "b");
      pareto.add(50, "c");
      chart.getChart().getTitle().setText("");
      frame.add(panel);
      frame.setSize(600, 600);
      frame.setVisible(true);
   }
} 
In this code I am setting left axis min and max to 0 and 50 respectively.
If you run the code then you can see that Marks are not visible.
This is a special case where the chart title is empty and axis max == max value for a CustomBar. Is there anyway I could display Marks on the bar itself? Or how can I make it visible at least?

Thanks,
Varun

Posted: Mon Nov 17, 2008 10:07 am
by narcis
Hi Varun,

Yes, this is because of the settings you used for left axis scale.

An option is setting marks ArrowLength to zero or a negative value, for example:

Code: Select all

        pareto.getMarks().setArrowLength(-5);
Another one is setting left axis maximum offset, for example:

Code: Select all

        chart.getAxes().getLeft().setMaximumOffset(50);
Last option I can think of would be setting custom marks positions as shown on this thread. This is a TeeChart for .NET thread but the same applies to the Java version.

Hope this helps!