can just supply inverted ranges.

This commit is contained in:
Will Charczuk 2017-01-09 17:57:45 -08:00
parent 21986dbce7
commit 78cbfa62bc
7 changed files with 66 additions and 29 deletions

View file

@ -1,9 +1,6 @@
package chart
import (
"math"
"sort"
)
import "math"
// YAxis is a veritcal rule of the range.
// There can be (2) y-axes; a primary and secondary.
@ -15,7 +12,8 @@ type YAxis struct {
Zero GridLine
AxisType YAxisType
AxisType YAxisType
Ascending bool
ValueFormatter ValueFormatter
Range Range
@ -74,8 +72,6 @@ func (ya YAxis) GetGridLines(ticks []Tick) []GridLine {
// Measure returns the bounds of the axis.
func (ya YAxis) Measure(r Renderer, canvasBox Box, ra Range, defaults Style, ticks []Tick) Box {
sort.Sort(Ticks(ticks))
var tx int
if ya.AxisType == YAxisPrimary {
tx = canvasBox.Right + DefaultYAxisMargin
@ -128,8 +124,6 @@ func (ya YAxis) Render(r Renderer, canvasBox Box, ra Range, defaults Style, tick
tickStyle := ya.TickStyle.InheritFrom(ya.Style.InheritFrom(defaults))
tickStyle.WriteToRenderer(r)
sort.Sort(Ticks(ticks))
sw := tickStyle.GetStrokeWidth(defaults.StrokeWidth)
var lx int