AAChartModel / AAChartKit

📈📊🚀🚀🚀An elegant modern declarative data visualization chart framework for iOS, iPadOS and macOS. Extremely powerful, supports line, spline, area, areaspline, column, bar, pie, scatter, angular gauges, arearange, areasplinerange, columnrange, bubble, box plot, error bars, funnel, waterfall and polar chart types. 极其精美而又强大的现代化声明式数据可视化图表框架,支持柱状图、条形图、折线图、曲线图、折线填充图、曲线填充图、气泡图、扇形图、环形图、散点图、雷达图、混合图等各种类型的多达几十种的信息图图表,完全满足工作所需.
https://cocoapods.org/pods/AAChartKit
MIT License
4.74k stars 752 forks source link

AAChartTypeAreaspline类型 Y轴数值类型 如何在数字后面添加百分号% #587

Closed NSMichael closed 5 years ago

NSMichael commented 5 years ago

image

AAChartModel commented 5 years ago

如下配置AAOptions实例对象

    AAChartModel *aaChartModel= AAChartModel.new
    .chartTypeSet(AAChartTypeAreaspline)
    .titleSet(@"")
    .subtitleSet(@"")
    .stackingSet(AAChartStackingTypeNormal)
    .markerRadiusSet(@0)
    .colorsThemeSet(@[
                      [AAGradientColor oceanBlueColor],
                      [AAGradientColor sanguineColor],
                      [AAGradientColor lusciousLimeColor],
                      [AAGradientColor mysticMauveColor],
                      ])
    .seriesSet(@[
                 AASeriesElement.new
                 .nameSet(@"Tokyo Hot")
                 .dataSet(@[@0.45, @0.43, @0.50, @0.55, @0.58, @0.62, @0.83, @0.39, @0.56, @0.67, @0.50, @0.34, @0.50, @0.67, @0.58, @0.29, @0.46, @0.23, @0.47, @0.46, @0.38, @0.56, @0.48, @0.36]),
                 AASeriesElement.new
                 .nameSet(@"Berlin Hot")
                 .dataSet(@[@0.38, @0.31, @0.32, @0.32, @0.64, @0.66, @0.86, @0.47, @0.52, @0.75, @0.52, @0.56, @0.54, @0.60, @0.46, @0.63, @0.54, @0.51, @0.58, @0.64, @0.60, @0.45, @0.36, @0.67]),
                 AASeriesElement.new
                 .nameSet(@"London Hot")
                 .dataSet(@[@0.46, @0.32, @0.53, @0.58, @0.86, @0.68, @0.85, @0.73, @0.69, @0.71, @0.91, @0.74, @0.60, @0.50, @0.39, @0.67, @0.55, @0.49, @0.65, @0.45, @0.64, @0.47, @0.63, @0.64]),
                 AASeriesElement.new
                 .nameSet(@"NewYork Hot")
                 .dataSet(@[@0.60, @0.51, @0.52, @0.53, @0.64, @0.84, @0.65, @0.68, @0.63, @0.47, @0.72, @0.60, @0.65, @0.74, @0.66, @0.65, @0.71, @0.59, @0.65, @0.77, @0.52, @0.53, @0.58, @0.53]),
                 ]
               );

    AAOptions *aaOptions = [AAOptionsConstructor configureChartOptionsWithAAChartModel:aaChartModel];

    aaOptions.legend = AALegend.new
    .enabledSet(true)
    .alignSet(AALegendAlignTypeRight)
    .layoutSet(AALegendLayoutTypeVertical)
    .verticalAlignSet(AALegendVerticalAlignTypeTop);

    aaOptions.yAxis.labels.format = @"{value} %";//给y轴添加单位

即可.

关键语句:

    aaOptions.yAxis.labels.format = @"{value} %";//给y轴添加单位

效果图:

image

AAChartModel commented 5 years ago

参考链接: https://blog.csdn.net/sinat_39626276/article/details/81354293