From RPM Wiki
| Table of contents |
[edit]
Summary
Functionality for rendering charts.
[edit]
Details
[edit]
HTML
- chart="true" in head control
<div class="chart"><canvas id="chart" width="700" height="200"></canvas></div> <asp:Label ID="chartData" runat="server" CssClass="chart pie"></asp:Label>
- Give that span one of the following sets of CSS classes:
- chart commRunLine money
- chart commRunLine percent
- chart pie
[edit]
Javascript
JavaScript charting based on Plotr (http://solutoire.com/plotr/) based on PlotKit (http://www.liquidx.net/plotkit/)
- Homepage (http://utils.softr.net/)
- Plotr.js is the compressed version and in RPM is located in Chart.js (3nd from top, after mootools above). We have one function added in the middle, ".addDatasetSimple" that must be added to the Plotr code.
[edit]
Line
[edit]
Pie
The dataset we're using can have any number of items, but pie charts are only useful up to a certain level of density. To address this, we'll have a system that displays a certain number of larger sliced, then groups all remaining items into one slice.
- We'll have two thresholds defined as constants in the application, a percent and a int.
- If all items are zero, don't render the chart and display a "None" message, else:
- Starting with the item with the largest % and working down add items until whichever threshold is reached first, the items so far or the total percentage so far. Then:
- If there is 0 remaining you're done, just return the set so far.
- If there is 1 remaining row add it, done.
- If there is more than 1 remaining, group the remaining into an "n remaining" item where n is the count. Add it, done.
- Examples, 12 items, thresholds are "90%" and "9":
- Alpha=80%, Bravo=15%, 10 remaining=5%
- Alpha=22%, Bravo=9%, Charlie=4%, Delta=2.9%, Echo=2.8%, Foxtrot=2.1%, Golf=1.5%, Hotel=0.9%, India=0.9%, 3 remaining=53.9%
- Example, 3 items, same thresholds:
- Alpha=80%, Bravo=15%, Charlie=5%
[edit]
History
- Europa: Server-side 3rd party control replaced with client-side
- This page was last modified 15:44, 5 Jun 2007.
- This page has been accessed 1105 times.
