https://github.com/zingchart/dwa-module
A ZingChart module to calculate the weighted average amongst your plots.
https://github.com/zingchart/dwa-module
Last synced: 6 months ago
JSON representation
A ZingChart module to calculate the weighted average amongst your plots.
- Host: GitHub
- URL: https://github.com/zingchart/dwa-module
- Owner: zingchart
- Created: 2016-06-07T20:37:58.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2021-12-03T19:27:35.000Z (over 4 years ago)
- Last Synced: 2024-12-27T21:14:32.140Z (over 1 year ago)
- Language: JavaScript
- Size: 129 KB
- Stars: 0
- Watchers: 6
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ZingChart Distributed Weighted Average Module
This module calculates the distributed weighted average of your plots.

### Usage
1. Include the module in your page after the zingchart library
2. Include the module reference in the zingchart.render({}) method.
zingchart.render({
id : 'myChart',
data : myConfig,
height: 400,
width: '100%',
modules: "dwa" // Include the dwa module!
});
### Docs
There are a couple attributes you can define in your chart configuration for the dwa module.
1. dwa (object) - This object can be defined in the root of the chart configuration. Within this object you can define two properties visibleAtFirst and name.
* visibleAtFirst (boolean) - If true this attribute will show the dwa plot when the graph loads. This is the default.
* name (string) - If defined, this name will appear in the legend. The default text is "Weighted Average".
* color (string) - If defined this will set the color of your dwa plot. Otherwise it will default to the standard library color for that plot.
dwa:{
// 'dwa' module is loaded in the render method below.
visibleAtFirst:true, // Default is true
name: "Distributed Weighted Average", // Optional Name
color: '#000' // Optional Color
},
2. weight (Number) - If defined, it must be defined within each individual series object. The default weight is 1, in which case the weighted average is an even distribution amongst plots.
series : [
{
values: [35,42,67,89,25,34,67,85],
weight: 0.4 // optional weight
},
{
values: [74,71,89,34,26,73,21,56],
weight: 0.6 // optional weight
}
]