• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

chartjs / chartjs-chart-smith / #91

pending completion
#91

push

web-flow
Bump semver from 5.7.1 to 5.7.2 in /docs (#80)

Bumps [semver](https://github.com/npm/node-semver) from 5.7.1 to 5.7.2.
- [Release notes](https://github.com/npm/node-semver/releases)
- [Changelog](https://github.com/npm/node-semver/blob/v5.7.2/CHANGELOG.md)
- [Commits](https://github.com/npm/node-semver/compare/v5.7.1...v5.7.2)

---
updated-dependencies:
- dependency-name: semver
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

17 of 41 branches covered (41.46%)

Branch coverage included in aggregate %.

64 of 171 relevant lines covered (37.43%)

3.27 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

6.67
/src/controller.js
1
import Chart from 'chart.js';
2

3
const helpers = Chart.helpers;
1✔
4
const resolve = helpers.options.resolve;
1✔
5
const valueOrDefault = helpers.valueOrDefault;
1✔
6

7
class Controller extends Chart.controllers.line {
8
        // Not needed since there is only a single scale
9
        // eslint-disable-next-line class-methods-use-this, no-empty-function
10
        linkScales() {}
11

12
        updateElement(point, index) {
13
                const me = this;
×
14
                const meta = me.getMeta();
×
15
                const custom = point.custom || {};
×
16
                const datasetIndex = me.index;
×
17
                const yScale = me.getScaleForId(meta.yAxisID);
×
18
                const xScale = me.getScaleForId(meta.xAxisID);
×
19
                const lineModel = meta.dataset._model;
×
20

21
                const options = me._resolvePointOptions(point, index);
×
22
                const {x, y} = me.calculatePointPosition(index);
×
23

24
                // Utility
25
                point._xScale = xScale;
×
26
                point._yScale = yScale;
×
27
                point._options = options;
×
28
                point._datasetIndex = datasetIndex;
×
29
                point._index = index;
×
30

31
                // Desired view properties
32
                point._model = {
×
33
                        x,
34
                        y,
35
                        skip: custom.skip || isNaN(x) || isNaN(y),
×
36
                        // Appearance
37
                        radius: options.radius,
38
                        pointStyle: options.pointStyle,
39
                        rotation: options.rotation,
40
                        backgroundColor: options.backgroundColor,
41
                        borderColor: options.borderColor,
42
                        borderWidth: options.borderWidth,
43
                        tension: valueOrDefault(custom.tension, lineModel ? lineModel.tension : 0),
×
44
                        steppedLine: lineModel ? lineModel.steppedLine : false,
×
45
                        // Tooltip
46
                        hitRadius: options.hitRadius
47
                };
48
        }
49

50
        /**
51
         * @private
52
         */
53
        _resolvePointOptions(element, index) {
54
                const me = this;
×
55
                const chart = me.chart;
×
56
                const dataset = chart.data.datasets[me.index];
×
57
                const custom = element.custom || {};
×
58
                const options = chart.options.elements.point;
×
59
                const values = {};
×
60
                let i, ilen, key;
61

62
                // Scriptable options
63
                const context = {
×
64
                        chart,
65
                        dataIndex: index,
66
                        dataset,
67
                        datasetIndex: me.index
68
                };
69

70
                const ELEMENT_OPTIONS = {
×
71
                        backgroundColor: 'pointBackgroundColor',
72
                        borderColor: 'pointBorderColor',
73
                        borderWidth: 'pointBorderWidth',
74
                        hitRadius: 'pointHitRadius',
75
                        hoverBackgroundColor: 'pointHoverBackgroundColor',
76
                        hoverBorderColor: 'pointHoverBorderColor',
77
                        hoverBorderWidth: 'pointHoverBorderWidth',
78
                        hoverRadius: 'pointHoverRadius',
79
                        pointStyle: 'pointStyle',
80
                        radius: 'pointRadius',
81
                        rotation: 'pointRotation'
82
                };
83
                const keys = Object.keys(ELEMENT_OPTIONS);
×
84

85
                for (i = 0, ilen = keys.length; i < ilen; ++i) {
×
86
                        key = keys[i];
×
87
                        values[key] = resolve([
×
88
                                custom[key],
89
                                dataset[ELEMENT_OPTIONS[key]],
90
                                dataset[key],
91
                                options[key]
92
                        ], context, index);
93
                }
94

95
                return values;
×
96
        }
97

98
        calculatePointPosition(dataIndex) {
99
                const scale = this.chart.scale;
×
100
                const data = this.getDataset().data[dataIndex];
×
101
                return scale.getPointPosition(data.real, data.imag);
×
102
        }
103
}
104

105
export default Controller;
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc