Skip to content

Commit 43ce9ac

Browse files
author
Jelte Lagendijk
committed
Add Line Chart setting: max tick size (suggested in #75)
1 parent 43ff5d5 commit 43ce9ac

File tree

4 files changed

+9
-1
lines changed

4 files changed

+9
-1
lines changed

src/ChartJS/widgets/LineChart/LineChart.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,11 @@
318318
<category>Settings Line Chart</category>
319319
<description>Whether the line is curved between points.</description>
320320
</property>
321+
<property key="maxTickSize" type="integer" required="true" defaultValue="0">
322+
<caption>Max tick size (X axis)</caption>
323+
<category>Settings Line Chart</category>
324+
<description>When there are many points on the X axis (horizontal), the labels can overlap. Setting the tick size means it will render only a certain amount of labels. Setting this to 0 will render them all</description>
325+
</property>
321326
<property key="bezierCurveTension" type="string" required="true" defaultValue="0.4">
322327
<caption>Bezier curve tension</caption>
323328
<category>Settings Line Chart</category>

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,10 @@ define([
154154
},
155155
type: "category",
156156
id: "x-axis-0",
157-
ticks : { fontFamily: this._font, }
157+
ticks : {
158+
fontFamily: this._font,
159+
maxTicksLimit: this.maxTickSize > 0 ? this.maxTickSize : null
160+
}
158161
}]
159162
},
160163

test/[Test] ChartJS.mpr

81 KB
Binary file not shown.

test/widgets/ChartJS.mpk

147 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)