mirror of
https://github.com/chartjs/Chart.js.git
synced 2024-10-06 04:09:08 +02:00
Use proper reverse option in radial linear scale
This commit is contained in:
parent
cc9e88aebc
commit
7d60857819
@ -244,7 +244,7 @@ module.exports = function(Chart) {
|
||||
ctx.lineWidth = angleLineOpts.lineWidth;
|
||||
ctx.strokeStyle = angleLineOpts.color;
|
||||
|
||||
var outerDistance = scale.getDistanceFromCenterForValue(opts.reverse ? scale.min : scale.max);
|
||||
var outerDistance = scale.getDistanceFromCenterForValue(opts.ticks.reverse ? scale.min : scale.max);
|
||||
|
||||
// Point Label Font
|
||||
var plFont = getPointLabelFontOptions(scale);
|
||||
@ -366,6 +366,7 @@ module.exports = function(Chart) {
|
||||
},
|
||||
convertTicksToLabels: function() {
|
||||
var me = this;
|
||||
|
||||
Chart.LinearScaleBase.prototype.convertTicksToLabels.call(me);
|
||||
|
||||
// Point labels
|
||||
@ -433,7 +434,7 @@ module.exports = function(Chart) {
|
||||
|
||||
// Take into account half font size + the yPadding of the top value
|
||||
var scalingFactor = me.drawingArea / (me.max - me.min);
|
||||
if (me.options.reverse) {
|
||||
if (me.options.ticks.reverse) {
|
||||
return (me.max - value) * scalingFactor;
|
||||
}
|
||||
return (value - me.min) * scalingFactor;
|
||||
@ -480,7 +481,7 @@ module.exports = function(Chart) {
|
||||
|
||||
helpers.each(me.ticks, function(label, index) {
|
||||
// Don't draw a centre value (if it is minimum)
|
||||
if (index > 0 || opts.reverse) {
|
||||
if (index > 0 || tickOpts.reverse) {
|
||||
var yCenterOffset = me.getDistanceFromCenterForValue(me.ticksAsNumbers[index]);
|
||||
var yHeight = me.yCenter - yCenterOffset;
|
||||
|
||||
|
@ -401,7 +401,7 @@ describe('Test the radial linear scale', function() {
|
||||
y: 275,
|
||||
});
|
||||
|
||||
chart.scale.options.reverse = true;
|
||||
chart.scale.options.ticks.reverse = true;
|
||||
chart.update();
|
||||
|
||||
expect(chart.scale.getDistanceFromCenterForValue(chart.scale.min)).toBe(233);
|
||||
|
Loading…
Reference in New Issue
Block a user