AAChartKit icon indicating copy to clipboard operation
AAChartKit copied to clipboard

如何给单独一个点设置图片?

Open kedu opened this issue 3 years ago • 4 comments

试了AADataElement的markerSet,用base64是无效的

kedu avatar Sep 15 '22 10:09 kedu

参考:

  • https://github.com/AAChartModel/AAChartKit/issues/695

将此示例的 marker 稍作修改:

- (AAChartModel *)configureSpecialStyleMarkerOfSingleDataElementChart2 {
    NSArray *stopsArr = @[
        @[@0.00, @"#febc0f"],//颜色字符串设置支持十六进制类型和 rgba 类型
        @[@0.25, @"#FF14d4"],
        @[@0.50, @"#0bf8f5"],
        @[@0.75, @"#F33c52"],
        @[@1.00, @"#1904dd"],
    ];
    
    NSDictionary *gradientColorDic1 =
    [AAGradientColor gradientColorWithDirection:AALinearGradientDirectionToRight
                                     stopsArray:stopsArr];
    
    AADataElement *singleSpecialData = AADataElement.new
    .markerSet(AAMarker.new
               .widthSet(@50)
               .heightSet(@50)
               .symbolSet(base64Symbol)//曲线点
               )
    .ySet(@26.5);
    
    return AAChartModel.new
    .chartTypeSet(AAChartTypeSpline)
    .backgroundColorSet(@"#4b2b7f")
    .dataLabelsEnabledSet(false)//是否显示值
    .tooltipEnabledSet(true)
    .markerRadiusSet(@0)
    .xAxisVisibleSet(false)
    .yAxisVisibleSet(false)
    .seriesSet(@[
        AASeriesElement.new
        .nameSet(@"Virtual Data")
        .lineWidthSet(@6)
        .dataSet(@[@7.0, @6.9, @2.5, @14.5, @18.2, singleSpecialData, @5.2, @26.5, @23.3, @45.3, @13.9, @9.6])
        .colorSet((id)gradientColorDic1)
               ]);
}

AAChartModel avatar Sep 16 '22 02:09 AAChartModel

以上稍作修改后的示例代码, base64Symbol 常量可在 AAChartKit 的 demo 中找到.

AAChartModel avatar Sep 16 '22 02:09 AAChartModel

好的

kedu avatar Sep 16 '22 08:09 kedu

参考文档:

  • https://api.highcharts.com.cn/highcharts/series.line.marker.html (中文官网)
  • https://api.highcharts.com/highcharts/series.line.marker.html (英文官网)

AAChartModel avatar Sep 16 '22 08:09 AAChartModel