Hi
I create a chart like this:
final JFreeChart chart = ChartFactory.createBarChart3D("MyDFS", "DFK", "DFX",defaultcategorydataset, PlotOrientation.VERTICAL, true, true,true);
When the chart is displayed the title MYDFS is at the top and center.
I want the title at the top however to the left.
Can you please let me know how to do it.
I tried:
chart.getTitle.setMargin(0,0,0,0)
but the title still shows at center.
Thanks
Rajan
Left justified title
-
- Posts: 513
- Joined: Wed Sep 12, 2007 3:18 pm
Re: Left justified title
TextTitle has parameters that let you change position, alignment and padding. You can experiment with differrent effects using setTitle().
Re: Left justified title
I tried
Looks like I may need to use layouts which I am reading now.
It should be simple, instead of displaying title in center, I want to display to left. Looking from other API's in JFreeChart I am sure there is some way to do this in a simple way.
Any other suggestions.
Thanks
Rajan
Looks like I may need to use layouts which I am reading now.
It should be simple, instead of displaying title in center, I want to display to left. Looking from other API's in JFreeChart I am sure there is some way to do this in a simple way.
Any other suggestions.
Thanks
Rajan
-
- Posts: 1634
- Joined: Sat Feb 17, 2007 1:51 pm
Re: Left justified title
Code: Select all
chart.getTitle().setHorizontalAlignment(HorizontalAlignment.LEFT);
Re: Left justified title
This will bring the title to the left side of the chart.
I want title to remain on top but instead of being displayed in the center, I want it left on left side.
Ex: It show like this right now
|----------------------------------------------- MYDFS ------------------------------------------|
I want it like:
|MYDFS-------------------------------------------------------------------------------------------|
Thanks
Rajan
I want title to remain on top but instead of being displayed in the center, I want it left on left side.
Ex: It show like this right now
|----------------------------------------------- MYDFS ------------------------------------------|
I want it like:
|MYDFS-------------------------------------------------------------------------------------------|
Thanks
Rajan
-
- Posts: 513
- Joined: Wed Sep 12, 2007 3:18 pm
Re: Left justified title
HorizontalAlignment.LEFT, suggested by @paradoxoff, does exactly what you show. Using addSubtitle() is another convenient way to experiment with the myriad settings.
Re: Left justified title
Sorry my mistake.
It works. (My build did not contain changes)
Thanks
Rajan
It works. (My build did not contain changes)
Thanks
Rajan