Hi,
I am using bar3d chart and the same is designed using ireport 4.5.1 and the jfreechart-1.0.14 is used
All properties are set in the jrxml and the chart renders without any errors
but the 3Dbars and the corresponding categoryTicklabels are not aligned properly (pls see the attachment), in the middle part of the chart, bars and the categoryTicklabels meet at the same point but going outer wards (both sides) there a gap is formed between the bars and the categoryTicklabels. I have been told that by using a customizer class I can fix this. if so please let me know what properties i have to set in the customizer class to fix this problem.
Thanks in advance...
Arun
Alignment problem in vertical bars and category labels
Re: Alignment problem in vertical bars and category labels
Hi!
JFreeChart has nothing such as "Customizers". This seems to come from JasperReport and has nothing to do with your concrete problem.
Your problem is, you are using the CategoryDataset in a wrong way. You use different series with a single item in each series, when you want to use a single series with multiple items in it.
If you need further assistance post the code that produces your dataset first.
hth,
- martin
JFreeChart has nothing such as "Customizers". This seems to come from JasperReport and has nothing to do with your concrete problem.
Your problem is, you are using the CategoryDataset in a wrong way. You use different series with a single item in each series, when you want to use a single series with multiple items in it.
If you need further assistance post the code that produces your dataset first.
hth,
- martin
Re: Alignment problem in vertical bars and category labels
Hi,
Thank you for the reply.. actually i have implemented the chart in jasper reports
and the Customizer belongs to jasper engine. Since I am using jasper reports there are limitations in setting the properties
of the chart within the jrxml file.
Please let me know if any other options are available.
In the category data set (As seen in the attached jrxml code) i have 2 fields "states" and their corresponding "values".
any way I tried one fix which is some what working (see the below code) but the width of the bar decreased by doing this
what i have done is i have overridden the customize method of jrchartcustomizer which can handle jfree chart object.
chart.getCategoryPlot().getDomainAxis().setCategoryMargin(0.7);
renderer.setItemMargin(0.0);
Thanks again..
Arun
Thank you for the reply.. actually i have implemented the chart in jasper reports
and the Customizer belongs to jasper engine. Since I am using jasper reports there are limitations in setting the properties
of the chart within the jrxml file.
Please let me know if any other options are available.
In the category data set (As seen in the attached jrxml code) i have 2 fields "states" and their corresponding "values".
any way I tried one fix which is some what working (see the below code) but the width of the bar decreased by doing this
what i have done is i have overridden the customize method of jrchartcustomizer which can handle jfree chart object.
chart.getCategoryPlot().getDomainAxis().setCategoryMargin(0.7);
renderer.setItemMargin(0.0);
Code: Select all
<categoryDataset>
<categorySeries>
<seriesExpression><![CDATA[$F{STATE}]]></seriesExpression>
<categoryExpression><![CDATA[$F{STATE}]]></categoryExpression>
<valueExpression><![CDATA[$F{LAENDER}]]></valueExpression>
<labelExpression><![CDATA["" +$F{LAENDER}]]></labelExpression>
</categorySeries>
</categoryDataset>
Arun
Re: Alignment problem in vertical bars and category labels
Hi again!
I know JasperReports but I've got close to no experience when it comes to using charts in it. Anyway, it's none of the visual properties of the chart that make it look like it does. It's your data that isn't used as supposed.
Could you eventually try to change to code you just posted and see if it helps.
Please replacewith
hth,
- martin
I know JasperReports but I've got close to no experience when it comes to using charts in it. Anyway, it's none of the visual properties of the chart that make it look like it does. It's your data that isn't used as supposed.
Could you eventually try to change to code you just posted and see if it helps.
Please replace
Code: Select all
<seriesExpression><![CDATA[$F{STATE}]]></seriesExpression>
Code: Select all
<seriesExpression><![CDATA["dummySeries"]]></seriesExpression>
- martin
Re: Alignment problem in vertical bars and category labels
Hi
thanks a lot that worked indeed..... but now my chart legend is replaced by "dummyValues"
my requirement is that the series and series name should be same.
Please suggest me how this can be achieved in category series..
Regards,
Arun
thanks a lot that worked indeed..... but now my chart legend is replaced by "dummyValues"
my requirement is that the series and series name should be same.
Please suggest me how this can be achieved in category series..
Regards,
Arun
Re: Alignment problem in vertical bars and category labels
A CategorySet is able to represent data in two-dimensions (like a table with rows and columns):
Your data just has a single row (or column):
But you are setting row and column keys in a way, that you use it like this:
In your original chart you thus have redundant information: the country-code is output in the legend and below each bar. In the legend it comes from the key of the series (row). Blow the bar it comes from the key of the category (column). You can't have it all. Either choose the series resp. category keys (row resp. column keys) to be equal on all datapoints, or live with a chart as you posted.
If you want the legend match your expectations but don't care about the category-keys just replace the <categoryExpression> instead of the <seriesExpression> and eventually hide the labels via the axis-API.
hth,
- martin
Code: Select all
+-+-+-+
|a|b|c|
+-+-+-+
|d|e|f|
+-+-+-+
|g|h|i|
+-+-+-+
Code: Select all
+-+-+-+
|a|b|c|
+-+-+-+
| | | |
+-+-+-+
| | | |
+-+-+-+
Code: Select all
+-+-+-+
|a| | |
+-+-+-+
| |b| |
+-+-+-+
| | |c|
+-+-+-+
If you want the legend match your expectations but don't care about the category-keys just replace the <categoryExpression> instead of the <seriesExpression> and eventually hide the labels via the axis-API.
hth,
- martin