代码之家  ›  专栏  ›  技术社区  ›  Kuldeep Jayesh Lathiya

如何在HighCharts中将动态文本内容设置为yAxis stackLabels?

  •  3
  • Kuldeep Jayesh Lathiya  · 技术社区  · 8 年前

    我要设置 yAxis stackLabels 内容动态显示如下链接所示。 好,优秀,差,一般,低于平均

    以下链接代码位于 JavaScript ,如何在中使用它 Objective C ?

    链接: Demo

    yAxis.stackLabel 没有与的属性 qTotals 在链接演示中使用。

    我想像下面的图片或显示在上面给定的链接。

    enter image description here

    任何帮助都将不胜感激。 提前谢谢。

    1 回复  |  直到 8 年前
        1
  •  1
  •   Kuldeep Jayesh Lathiya    8 年前

    这是解决方案。

    如果要根据 yAxis dataLabels总计。

    [HIStackLabels alloc]init];
    yaxis.stackLabels.enabled = [[NSNumber alloc] initWithBool:true];
    yaxis.stackLabels.formatter = [[HIFunction alloc] initWithFunction:@"function() { if(this.total > 9) return 'Good'; if(this.y == 30) return 'Average';}"];
    

    如果我们想根据特定列设置文本。

    column1.dataLabels = [[HIDataLabels alloc]init];
    column1.dataLabels.enabled = [NSNumber numberWithInteger:1];
    column1.dataLabels.formatter = [[HIFunction alloc] initWithFunction:@"function() { if(this.y == 60) return 'Poor'; if(this.y == 30) return 'Average';}"];