{"id":4352,"date":"2017-01-05T03:00:50","date_gmt":"2017-01-04T19:00:50","guid":{"rendered":"http:\/\/www.finereport.com\/en\/?p=4352"},"modified":"2018-09-11T17:18:19","modified_gmt":"2018-09-11T09:18:19","slug":"how-to-make-a-functional-dynamic-chart-data","status":"publish","type":"post","link":"https:\/\/www.finereport.com\/en\/product-functions\/how-to-make-a-functional-dynamic-chart-data.html","title":{"rendered":"How to Make a Functional Dynamic Chart Data?"},"content":{"rendered":"<h3>1. Function description<\/h3>\n<p>Sometimes, the user wants to display different charts based on different conditions, as shown below. Select Year and Month condition, and the chart, as a great <a title=\"FineReport BI and reporting tool\" href=\"\/en\/\" target=\"_blank\">reporting tool<\/a>, will display data meeting certain conditions so as to realize dynamic chart:<br \/>\n<img src=\"http:\/\/www.finereport.com\/en\/wp-content\/themes\/fanruan\/images\/010401.png\" alt=\"\" \/><\/p>\n<h3>2. Realization ideasEdit<\/h3>\n<p>Dynamically change chart data source based on parameter conditions.<br \/>\nIf the chart data is from dataset, you can dynamically change chart data through data source parameters.<br \/>\nIf the chart data is from cell, you can change chart data through report parameter and filter setting, which will serve as an example in this section.<\/p>\n<h3>3. Example<\/h3>\n<p><strong>3.1 Prepare data<\/strong><br \/>\nCreate a new workbook and add dataset ds1, with SQL statement of <span style=\"color: purple;\">SELECT strftime(&#8216;%Y&#8217;, ordering date) as year, strftime(&#8216;%m&#8217;, ordering date) as month, shipper\u2019s province, payable FROM [order]<\/span>.<br \/>\n<strong>3.2 Define parameters<\/strong><br \/>\nWe will dynamically change the chart based on selected year and month. Define the 3 report parameters below:<br \/>\nReport parameter Year: year. Default value: 2010;<br \/>\nReport parameter Start: start month. Default value: 1;<br \/>\nReport parameter End: end month. Default value: 6.<br \/>\nThe Parameter Interface is designed as follows:<br \/>\n<img src=\"http:\/\/www.finereport.com\/en\/wp-content\/themes\/fanruan\/images\/010402.png\" alt=\"\" \/><\/p>\n<p><img loading=\"lazy\" class=\"alignleft\" src=\"http:\/\/www.finereport.com\/en\/wp-content\/themes\/fanruan\/images\/010411.png\" alt=\"\" width=\"166\" height=\"170\" \/><br \/>\n<img loading=\"lazy\" class=\"alignleft\" src=\"http:\/\/www.finereport.com\/en\/wp-content\/themes\/fanruan\/images\/010403.png\" alt=\"\" width=\"181\" height=\"172\" \/><img src=\"http:\/\/www.finereport.com\/en\/wp-content\/themes\/fanruan\/images\/010412.png\" alt=\"\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><strong>3.3 Make a sample table<\/strong><br \/>\nIn the cell, calculate and summarize the sales volumes of several months in a year for different provinces, as shown below:<br \/>\n<img src=\"http:\/\/www.finereport.com\/en\/wp-content\/themes\/fanruan\/images\/010404.png\" alt=\"\" \/><br \/>\nSet the data column as below:<br \/>\n<img src=\"http:\/\/www.finereport.com\/en\/wp-content\/themes\/fanruan\/images\/010405.png\" alt=\"\" \/><br \/>\nBased on parameter values, the data calculated in the cell are different. When cell is used as the data source, the chart also displays different data so as to realize dynamic chart, a good <a title=\"FineReport reporting and business intelligence tool\" href=\"\/en\/\" target=\"_blank\">business intelligence tool<\/a>, and help\u00a0<a title=\"FineReport data analysis\" href=\"\/en\/help\/data-analysis\" target=\"_blank\">data analysis<\/a> and\u00a0<a title=\"FineReport BI and reporting tool data visualization\" href=\"\/en\/help\/data-visualization\" target=\"_blank\">data visualization<\/a>.<br \/>\n<strong>3.4 Insert chart<\/strong><br \/>\nMerge a group of cells, as shown above. Right click<span style=\"color: purple;\"> Cell Element &gt; Insert Chart<\/span>. Select Column Chart and click OK.<br \/>\n<strong>3.5 Set chart type<\/strong><br \/>\nSet Column Chart Type to 3D Column Chart, as shown below:<br \/>\n<img src=\"http:\/\/www.finereport.com\/en\/wp-content\/themes\/fanruan\/images\/010406.png\" alt=\"\" \/><br \/>\n<strong>3.6 Set chart data<\/strong><br \/>\nThe chart data is from the cell. The data category axis is Region; Series name is Month; and Series Value is Sales Volume, as shown below:<br \/>\n<img src=\"http:\/\/www.finereport.com\/en\/wp-content\/themes\/fanruan\/images\/010407.png\" alt=\"\" \/><br \/>\nClick Save to complete a dynamic chart that can be changed with parameter change.<br \/>\n<strong>3.7 Set dynamic title<\/strong><br \/>\nSet a dynamic title for the chart. Select Chart and select<span style=\"color: purple;\"> Chart Attribute Table &#8211; Style&gt; Title<\/span>. Click formula button, where the formula is =$Year+&#8221; year &#8220;+$Start+&#8221;\u2014&#8221;+$End+&#8221; &#8220;. Display dynamic title based on different parameters.<br \/>\n<img src=\"http:\/\/www.finereport.com\/en\/wp-content\/themes\/fanruan\/images\/010408.png\" width=750 alt=\"\" \/><br \/>\nFinal template style in the main body of report is as shown below:<br \/>\n<img src=\"http:\/\/www.finereport.com\/en\/wp-content\/themes\/fanruan\/images\/010409.png\" alt=\"\" \/><br \/>\n<strong>3.8 Save and preview<\/strong><br \/>\nSave template and click Page-breaking Preview to see the effect as shown above.<br \/>\n<img src=\"http:\/\/www.finereport.com\/en\/wp-content\/themes\/fanruan\/images\/010410.png\" alt=\"\" \/><br \/>\nFor completed templates, see:<span style=\"color: blue;\">%FR_HOME%\\WebReport\\WEB-INF\\reportlets\\doc\\Advanced\\Chart\\Dynamic.cpt<\/span>\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. Function description Sometimes, the user wants to display different charts based on different conditions, as shown below. Select Year and Month condition, and the chart, as a great reporting tool, will display data meeting certain conditions so as to realize dynamic chart: 2. Realization ideasEdit Dynamically change chart data source based on parameter conditions&#8230;.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[111],"tags":[126,117],"yst_prominent_words":[569,1675,586,2595,568],"_links":{"self":[{"href":"https:\/\/www.finereport.com\/en\/wp-json\/wp\/v2\/posts\/4352"}],"collection":[{"href":"https:\/\/www.finereport.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.finereport.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.finereport.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.finereport.com\/en\/wp-json\/wp\/v2\/comments?post=4352"}],"version-history":[{"count":4,"href":"https:\/\/www.finereport.com\/en\/wp-json\/wp\/v2\/posts\/4352\/revisions"}],"predecessor-version":[{"id":4612,"href":"https:\/\/www.finereport.com\/en\/wp-json\/wp\/v2\/posts\/4352\/revisions\/4612"}],"wp:attachment":[{"href":"https:\/\/www.finereport.com\/en\/wp-json\/wp\/v2\/media?parent=4352"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.finereport.com\/en\/wp-json\/wp\/v2\/categories?post=4352"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.finereport.com\/en\/wp-json\/wp\/v2\/tags?post=4352"},{"taxonomy":"yst_prominent_words","embeddable":true,"href":"https:\/\/www.finereport.com\/en\/wp-json\/wp\/v2\/yst_prominent_words?post=4352"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}