Skip to content

Commit 7fe3063

Browse files
committed
The font Option is now used on the axes aswell
Previously only the legend used the font property. This fixed that; both axes now use the same font as set in the property. Fixed for all relevant charts (Doughnut, Pie and polar don't have axes)
1 parent 2e8b31a commit 7fe3063

File tree

5 files changed

+31
-19
lines changed

5 files changed

+31
-19
lines changed

src/ChartJS/widgets/BarChart/widget/BarChart.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,15 @@ define([
108108
type: "bar",
109109
data: data,
110110
options: {
111+
scales : {
112+
xAxes: [{
113+
ticks : { fontFamily: this._font, }
114+
}],
115+
yAxes: [{
116+
ticks : { fontFamily: this._font, }
117+
}],
118+
119+
},
111120

112121
responsive : this.responsive,
113122
responsiveAnimationDuration : (this.responsiveAnimationDuration > 0 ? this.responsiveAnimationDuration : 0),

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,15 +118,19 @@ define([
118118
this._chart.update(1000);
119119
this._chart.bindEvents(); // tooltips otherwise won't work
120120
} else {
121-
logger.debug("stacked:" + this.isStacked);
121+
logger.debug("stacked:" + this.isStacked);
122122
this._chart = new this._chartJS(this._ctx, {
123123
type: "line",
124124
data: data,
125125
options: {
126126
scales : {
127127
yAxes: [{
128128
//If stacked is set to true, the Y-axis needs to be stacked for it to work
129-
stacked: this.isStacked
129+
stacked: this.isStacked,
130+
ticks : { fontFamily: this._font }
131+
}],
132+
xAxes: [{
133+
ticks : { fontFamily: this._font, }
130134
}]
131135
},
132136

src/ChartJS/widgets/StackedBarChart/widget/StackedBarChart.js

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,22 @@ define([
110110
type: "bar",
111111
data: data,
112112
options: {
113-
113+
scales: {
114+
xAxes: [{
115+
stacked: true,
116+
ticks: {
117+
fontFamily :this._font
118+
//beginAtZero: true
119+
}
120+
}],
121+
yAxes: [{
122+
stacked: true,
123+
ticks: {
124+
fontFamily: this._font
125+
//suggestedMax: 10
126+
}
127+
}]
128+
},
114129
responsive : this.responsive,
115130
responsiveAnimationDuration : (this.responsiveAnimationDuration > 0 ? this.responsiveAnimationDuration : 0),
116131
tooltips : {
@@ -169,22 +184,6 @@ define([
169184

170185
// Custom tooltip?
171186
customTooltips : false, //lang.hitch(this, this.customTooltip)
172-
173-
scales: {
174-
xAxes: [{
175-
stacked: true,
176-
ticks: {
177-
//beginAtZero: true
178-
}
179-
}],
180-
yAxes: [{
181-
stacked: true,
182-
ticks: {
183-
//suggestedMax: 10
184-
}
185-
}]
186-
}
187-
188187
}
189188
});
190189
}

test/[Test] ChartJS.mpr

9 KB
Binary file not shown.

test/widgets/ChartJS.mpk

89 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)