Home
Analytics
To sort x-axis for monthname year in birt
jain
Hi, I have created the bar chart report using Birt3.7, I have added the amount on the y axis, and monthname + year on the x-axis. The data displays, but the ordering what I want is to display most recent year period should appear at the far right of the bar chart and the other periods will follow to the left of it in descending order. Can anyone give me some solution? I have attached the report for your reference.
Find more posts tagged with
Comments
mwilliams
Take a look at this modified design. I added a column in the dataSet called year. In the chart, I then used this field to sort the chart. Hope this helps.
jain
Hi Michael, Thanks for your reply. I have checked the design file its working as expected. Thanks a lot
mwilliams
You're welcome! Glad to help! Let us know whenever you have questions!
jain
Hi Michael, I have one more question regarding x-axis sorting for the year, have created the bar chart with year(datatype: String) in x-axis.The bar chart is displaying as below, could you please let me know in what way I can sort it? I have attached the report design file for your reference.
Actual result Expected result
1 year 1 year
10 year 3 year
3 year 5 year
5 year 7 year
7 year 10 year
Since Since
jain
Hi Michael, I have used the substr function in fetch method, when I previewed the report is showing "TypeError: Cannot find function substr in object " I am using BIRT3.7 version
kclark
jain, can you post the code with the substr or the rptdesign please?
jain
Hi Kclark thanks for your response, when I tried to add substr function in fetch method, its showing "type error: cannot find the function substr". Please find the attached rptdesign file.
kclark
When running your report I was unable to recreate that error message. The report is also blank, I'm looking at the rest of the code now but I would suggest trying to download BIRT again to see if this gets rid of your error message.
jain
Thanks Kclark, actually I am using scripted dataset, in fetch method I have used the code "row["Year"] = row["Period"].substr(row["Period"].length - 4, 4)" its showing "Typeerror: cannot find the function substr". so If you comment the code and preview it will show the result. Meanwhile I will also try downloading the BIRT again and check.