Sorting a report/bar chart

Sorting a report/bar chart

Comments

  • Is there a way to sort a report/bar chart desc by result counts within the report? I dont see the option anywhere or see anything in the documentation.

  • The built in Reports in Decisions do not have a way to order their bar chart views, so to accomplish your goal, I recommend using a diagram tile. I have put together an example of how you can create a bar chart ordered by count ascending or descending. On your page, you can replace your bar chart with a diagram tile. Once youve added that, create a Diagram Tile Flow.

    This flow is going to be used to configure your new bar chart. Once inside the diagram tile flow, go to Diagram Tile Inputs and click Show Editor. You will want to make the datatype a list of LineDefinition and give it a name. Then drag a Bars component from your step toolbox and set the ChartStyle in its properties to MultipleSeries. From here, you can also change the appearance of your chart to include labels, a grid, border color & width, & background color. Set the bar charts input, Bar Data, to the list you defined in the diagram tiles inputs.

    Once the diagram tile has been set up, return to your page and click on your diagram tile. Its properties panel now contains a setting for Input Data Flow. Edit this flow and re-create the flow shown in the attached screenshots. Well use a fetch entities step gathering all of the entities you wish to use in the tiles bar chart. Then, map the results into a ForEach In Group Step. This step will divide the list of entities gathered into groups based on one its properties. In Field to Group By, select the field containing your desired data and map the output into an Add Item to List Step. Set the list type in your Add Item to List step to SegmentData [DecisionsFramework.Design.Flow.Annotations] and change the steps input to Build Data. Map the First field from Each Grouping into Label and the Count of each group into Value. Next, add a Sort Array step to your flow, and map the output from your add item to list step into it. In the steps Sort Parameters, set the field to Value and Order to either ascending or descending. Now we have a grouped and sorted list of data for the bar chart, but its not in a form that it useful to it yet. Now, on the flows end step set its input data to Build Array and set Item 0 to Build Data. You can then pass your sorted array directly into SegmentData and ignore the other fields.

    Save the flow and return to your page. It should now display a sorted bar chart with the same data used from your original report.

Sign In or Register to comment.