Pie Graph
A graphical element used to visualize the proportion of a value to a max value.
Pie Graphs are components that can be added to the Create Pages, Detail Pages, Dashboard, and Standalone pages to provide a graphic representation for data.
It is used to show data that can be put into a scale of 1 to 100.
Go to a Page Layout. Select Graphs
. Select Pie Graph
.
Locate the Bar Graph on the layout editor. Click Configure Pie Graph
.
Bar Graph Configuration
Title Expression – Type the name of the Pie Graph inside quotation marks.
Visual – Select from Pie and Doughnut.
Slices Data Source – Define the source from which the data will be taken for each slice. See below for examples.
Visible Expression – Define when the graph will be displayed.
The coding can be customized. Two options are the following:
Slices Data Source Examples
Dynamic Slices
Establishes slices of the Pie Graph based upon the values that are entered for an attribute of the entity.
Enter the following text in the Slices Data Source section:
(_, _, db, ctx) => db.DailySnapshotSet
.GroupBy(s => s.Exercise)
.Select(eg => new PieGraph.Slice(eg.Key, eg.Count()))
The database (i.e., db.DailySnapshotSet) is established as the entity from which the data will be taken. The entity (i.e., Exercise) provides that data for the slices on the second line of code.
Custom Slices
Defines the individual slices of the Pie Graph with C# coding.
(_, _, db, ctx) => new PieGraph.Slice[ ]
{
new PieGraph.Slice("Running", db.DailySnapshotSet
.Where(ds => ds.Exercise.Contains("Running")).Count()),
new PieGraph.Slice("Gardening", db.DailySnapshotSet
.Where(ds => ds.Exercise.Contains("Gardening")).Count()),
}
The database (i.e., db.DailySnapshotSet) should be established as the entity from which the data will be taken. The entity (i.e., s.Exercise) for the slices should be established on the second line.
Graph Adjusting in the App
Note that the slices of the graphic can be adjusted. Click the title of a slice to remove it from the pie graph (i.e., it will be crossed out).