Shinobi Chart初步数据缩小了

时间:2016-09-20 20:22:49

标签: shinobi

可以设置shinobi charts的起始缩小值吗?

我已经尝试将一个日期设置为开始日期,并将日期添加到SChartDateRange(X轴)的结束日期,但没有解决。

提前致谢!

当前表&轴设置

 //properties
@IBOutlet weak var chartView: UIView!
private var chart:ShinobiChart?
private let chartDataSource = LineGraphModDataSource()


//methods
override func viewDidLoad()
{
super.viewDidLoad()

chart = ShinobiChart(frame: chartView.bounds)
chartView.addSubview(chart!)

self.setupChart()

}//eom

func setupChart()
{
    chart?.delegate = self
    chart?.licenseKey =  Constants.shared.getLicenseKey()
    chart?.title             = "Chart #9"
    chart?.autoresizingMask  = [.flexibleHeight , .flexibleWidth]
    chart?.datasource = chartDataSource

/* X axis - Dates */
let dateRange:SChartDateRange = chartDataSource.getInititalDateRange()
chart?.xAxis = SChartDateTimeAxis()
chart?.xAxis.range = dateRange
chart?.xAxis.axisPosition = SChartAxisPositionNormal
chart?.xAxis.title = "Dates"
chart?.xAxis.labelFormatString = "MM dd yy"
chart?.xAxis.majorTickFrequency = SChartDateFrequency.dateFrequency(withDay: 3)
chart?.xAxis.minorTickFrequency = SChartDateFrequency.dateFrequency(withDay: 1)

//style
    //major
chart?.xAxis.style.majorGridLineStyle.showMajorGridLines = true
chart?.xAxis.style.majorTickStyle.showTicks = true
chart?.xAxis.style.majorTickStyle.showLabels = true

    //minor
chart?.xAxis.style.minorTickStyle.showTicks = true
chart?.xAxis.style.minorTickStyle.showLabels = true

//axis movement
chart?.xAxis.enableGesturePanning = true
chart?.xAxis.enableGestureZooming = true
chart?.xAxis.enableMomentumPanning = true
chart?.xAxis.enableMomentumZooming = true

/* Y axis - Values */
chart?.yAxis = SChartNumberAxis()
chart?.yAxis.defaultRange = SChartRange(minimum: 0, andMaximum: 10)
chart?.yAxis.title = "Y axis"
chart?.yAxis.axisPosition = SChartAxisPositionReverse
chart?.yAxis.majorTickFrequency = 1
chart?.yAxis.minorTickFrequency = 1
chart?.yAxis.rangePaddingLow = 0.5
chart?.yAxis.rangePaddingHigh = 0.5


//style
chart?.yAxis.style.majorGridLineStyle.showMajorGridLines = true
chart?.yAxis.style.majorTickStyle.showTicks = true
chart?.yAxis.style.majorTickStyle.showLabels = true
chart?.yAxis.style.minorTickStyle.showTicks = true
chart?.yAxis.style.minorTickStyle.showLabels = true

//axis movement
chart?.yAxis.enableGesturePanning = true
chart?.yAxis.enableGestureZooming = true
chart?.yAxis.enableMomentumPanning = true
chart?.yAxis.enableMomentumZooming = true

} // EOM

当前起始图 Current starting graph

所需的起始图 Desired starting graph

0 个答案:

没有答案