jquery.sparkline icon indicating copy to clipboard operation
jquery.sparkline copied to clipboard

Reversing order of y-axis values

Open das-shrike opened this issue 11 years ago • 4 comments

The standard behaviour of sparkline is that values grow from lowest to highest along the vertical axis, i.e. (0,0) at bottom left.

Feature request: It would be great to have it the other way round, i.e., that the lowest value starts at the top and the highest value is at the bottom. (0,0) would, thus, be in the upper left corner.

(I tried a workaround by multiplying with -1 but the result is not satisfying.)

das-shrike avatar Nov 21 '13 15:11 das-shrike

+1

512banque avatar Jan 24 '14 11:01 512banque

Any update on this feature? I too need reverse Y-axis feature.

ankurraiyani avatar Jul 13 '15 12:07 ankurraiyani

+1

khaosdoctor avatar Jul 13 '16 18:07 khaosdoctor

@das-shrike I managed to work around this by reversing the chart and unreversing the tooltip using the formatter.

  1. Multiplied everything by -1 and added to the sparkline chart
  2. Added this:
tooltipFormatter: function(sparkline, options, point) {
            return Math.abs(point.y)+'º '+Math.abs(options.userOptions.tooltipValueLookups.points.map[point.y]) + ' pts.';
        },

To the options, which returns Xº Z pts. (in my case that just did it).

khaosdoctor avatar Jul 13 '16 19:07 khaosdoctor