forked from highcharts/highcharts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added format and formatter options for series.label
- Loading branch information
1 parent
a03e27a
commit d7910a3
Showing
7 changed files
with
279 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
resources: | ||
- https://code.jquery.com/qunit/qunit-2.0.1.js | ||
- https://code.jquery.com/qunit/qunit-2.0.1.css | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<script src="https://code.highcharts.com/highcharts.js"></script> | ||
<script src="https://code.highcharts.com/modules/series-label.js"></script> | ||
|
||
|
||
<div id="qunit"></div> | ||
<div id="qunit-fixture"></div> | ||
|
||
<div id="container"></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
QUnit.test('Series label', function (assert) { | ||
const chart = Highcharts.chart('container', { | ||
chart: { | ||
width: 400 | ||
}, | ||
series: [{ | ||
data: [1, 3, 2, 4], | ||
label: { | ||
enabled: true | ||
} | ||
}, { | ||
data: [1, 3, 2, 4], | ||
label: { | ||
format: 'Format {name}', | ||
formatter: function () { | ||
return 'Formatter ' + this.name; | ||
} | ||
} | ||
}, { | ||
data: [1, 3, 2, 4], | ||
label: { | ||
formatter: function () { | ||
return 'Formatter ' + this.name; | ||
} | ||
} | ||
}] | ||
}); | ||
|
||
assert.strictEqual( | ||
chart.series[0].labelBySeries.text.textStr, | ||
'Series 1', | ||
'Default series label should be series name' | ||
); | ||
|
||
assert.strictEqual( | ||
chart.series[1].labelBySeries.text.textStr, | ||
'Format Series 2', | ||
'Series label with format should take precedence' | ||
); | ||
|
||
assert.strictEqual( | ||
chart.series[2].labelBySeries.text.textStr, | ||
'Formatter Series 3', | ||
'Series label with formatter' | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.