Skip to content

Commit bd63d7b

Browse files
committed
Merge pull request #65 from Mcpoowl/master
Added options for pointDot
2 parents 3e9b470 + 26e5c52 commit bd63d7b

File tree

4 files changed

+35
-29
lines changed

4 files changed

+35
-29
lines changed

src/ChartJS/widgets/LineChart/LineChart.xml

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -296,25 +296,30 @@
296296
<category>Settings Line Chart</category>
297297
<description>Tension of the bezier curve between points. (This is usually around 0.4 or lower)</description>
298298
</property>
299-
<property key="pointDot" type="boolean" required="true" defaultValue="true">
300-
<caption>Point dot</caption>
301-
<category>Settings Line Chart</category>
302-
<description>Whether to show a dot for each point.</description>
303-
</property>
304-
<property key="pointDotRadius" type="string" required="true" defaultValue="4">
305-
<caption>Point dot radius</caption>
306-
<category>Settings Line Chart</category>
307-
<description>Radius of each point dot in pixels.</description>
299+
<property key="pointRadius" type="integer" required="true" defaultValue="3">
300+
<caption>Dot radius</caption>
301+
<category>Data Point</category>
302+
<description>Radius of each point dot in pixels. Set to zero to disable dots</description>
308303
</property>
309-
<property key="pointDotStrokeWidth" type="string" required="true" defaultValue="1">
310-
<caption>Point dot stroke width</caption>
311-
<category>Settings Line Chart</category>
304+
<property key="pointBorderWidth" type="integer" required="true" defaultValue="1">
305+
<caption>Dot stroke width</caption>
306+
<category>Data Point</category>
312307
<description>Pixel width of point dot stroke.</description>
313308
</property>
314-
<property key="pointHitDetectionRadius" type="string" required="true" defaultValue="20">
315-
<caption>Point hit detection radius</caption>
316-
<category>Settings Line Chart</category>
317-
<description>amount extra to add to the radius to cater for hit detection outside the drawn point.</description>
309+
<property key="pointHitRadius" type="integer" required="true" defaultValue="20">
310+
<caption>Dot hit detection</caption>
311+
<category>Data Point</category>
312+
<description>Extra width to add to cater for hover hit detection</description>
313+
</property>
314+
<property key="pointHoverRadius" type="integer" required="true" defaultValue="4">
315+
<caption>Dot hover radius</caption>
316+
<category>Data Point</category>
317+
<description>Radius of each point dot in pixels when hovered over it</description>
318+
</property>
319+
<property key="pointHoverBorderWidth" type="integer" required="true" defaultValue="1">
320+
<caption>Dot hover stroke</caption>
321+
<category>Data Point</category>
322+
<description>Width of stroke when hovered over it</description>
318323
</property>
319324
<property key="scaleLineWidth" type="string" required="true" defaultValue="1.0">
320325
<caption>Scale line width</caption>

src/ChartJS/widgets/LineChart/widget/LineChart.js

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ define([
7878
_bezier = 0.4;
7979
}
8080

81+
8182
_set = {
8283
label : (this.scaleShowLabelsBottom === true) ? label : "",
8384
backgroundColor: (this.seriesColorReduceOpacity) ? this._hexToRgb(color, "0.2") : color,
@@ -89,6 +90,7 @@ define([
8990
data : points,
9091
fill: this.seriescolorfilled,
9192
tension : this.bezierCurve ? _bezier : 0
93+
9294
};
9395
this._chartData.datasets.push(_set);
9496
this._activeDatasets.push({
@@ -108,6 +110,7 @@ define([
108110
},
109111

110112
_createChart : function (data) {
113+
111114
logger.debug(this.id + "._createChart");
112115

113116

@@ -167,7 +170,16 @@ define([
167170
display: this.showLegend,
168171
labels : { fontFamily : this._font }
169172
},
170-
173+
elements: {
174+
175+
point: {
176+
radius : this.pointRadius,
177+
borderWidth : this.pointBorderWidth,
178+
hitRadius : this.pointHitRadius,
179+
hoverRadius : this.pointHoverRadius,
180+
hoverBorderWidth : this.pointHoverBorderWidth
181+
}
182+
},
171183
//Boolean - Whether to show labels on the scale
172184
scaleShowLabels : this.scaleShowLabels,
173185

@@ -189,18 +201,6 @@ define([
189201
//Boolean - Whether or not to render as a stacked chart
190202
stacked : this.isStacked,
191203

192-
//Boolean - Whether to show a dot for each point
193-
pointDot : this.pointDot,
194-
195-
//Number - Radius of each point dot in pixels
196-
pointDotRadius : this.pointDotRadius,
197-
198-
//Number - Pixel width of point dot stroke
199-
pointDotStrokeWidth : this.pointDotStrokeWidth,
200-
201-
//Number - amount extra to add to the radius to cater for hit detection outside the drawn point
202-
pointHitDetectionRadius : this.pointHitDetectionRadius,
203-
204204
//Boolean - Whether to show a stroke for datasets
205205
datasetStroke : this.datasetStroke,
206206

@@ -230,6 +230,7 @@ define([
230230
}
231231
});
232232

233+
233234
this.connect(window, "resize", lang.hitch(this, function () {
234235
this._resize();
235236
}));

test/[Test] ChartJS.mpr

6 KB
Binary file not shown.

test/widgets/ChartJS.mpk

14 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)