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”
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.
- 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.
- Need to update the query to differentiate store_Type in Boolean value,following statement need to be updates in dataset query.
- Need to create one variable with any name,here we are creating “Store_type” with following expression
- Update following property to manage the x.axis values:
- Update following property to replace the store_type string
- After updating the above properties final result set is
<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>
“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”
Where 0-Starting store_name Value,1-store interval values,12-Max store_name values
In case if you have any queries please get us at support@helicaltech.com
Thanks
Ramu Vudugula
BI Developer
Helical IT Solutions Pvt Ltd
Best Open Source Business Intelligence Software Helical Insight Here
A Business Intelligence Framework
Best Open Source Business Intelligence Software Helical Insight is Here