High-Chart Label Formatting

Posted on by By Ramu Vudugula, in Jaspersoft | 0

High-chart label Formatting

Prerequisites: Jasper Server 6.4.2

Database: Foodmart

In this blog,we trying to formatting the x.axis label in StackedColumnSpline chart.

In chart,it shows store_type-Wise, Store-wise Store_Sales, Store_Cost and Unit_Sales with following dataset query.

 
“select s.store_type,
s.store_name,sum(store_sales) as sales,sum(Store_cost) as Store_cost,sum(unit_sales) as unit_sales
from sales_fact_1997 sf inner join store s on s.store_id=sf.store_id
group by store_type,s.store_name”

High-chart

Above chart need to update x.axis label,by grouping with different background color the store_type separately with respective Store_Name.

Need to update following property in that.

  1. Need to Add following expression in source code,to set the store_type value ‘From’ to ‘to’,set label to displays and background color to set group wise.
  2. <hc:propertyExpression><![CDATA["(function(){return [{color:'#FFFFFF',from:-0.5,to:6.5,label:{text:'Market',verticalAlign:'top',y:15}},{color:'#EEEEEE',from:6.5,to:12.5,label:{text:'SuperMarket',verticalAlign:'top',y:15}}] })()"]]></hc:propertyExpression>
    
  3. Need to update the query to differentiate store_Type in Boolean value,following statement need to be updates in dataset query.
  4. “select * from (select case when store_type='Supermarket' then 'true' else 'false' end as store_type,
    s.store_name,sum(store_sales) as sales,sum(Store_cost) as Store_cost,sum(unit_sales) as unit_sales
    from sales_fact_1997 sf inner join store s on s.store_id=sf.store_id
    group by store_type,s.store_name) as a
    order by store_type,store_name”
    
  5. Need to create one variable with any name,here we are creating “Store_type” with following expression
  6. variable

  7. Update following property to manage the x.axis values:
  8. x-axis

    Where 0-Starting store_name Value,1-store interval values,12-Max store_name values

  9. Update following property to replace the store_type string
  10. store-type

  11. After updating the above properties final result set is

output

In case if you have any queries please get us at support@helicaltech.com

Thanks
Ramu Vudugula
BI Developer
Helical IT Solutions Pvt Ltd

logo

Best Open Source Business Intelligence Software Helical Insight Here

logo

A Business Intelligence Framework


logo

Best Open Source Business Intelligence Software Helical Insight is Here

logo

A Business Intelligence Framework

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments