Dataset point label manipulation

Article ID: 2222
Last updated: 29 May, 2018
Article ID: 2222
Last updated: 29 May, 2018
Revision: 3
Views: 743
Posted: 26 Oct, 2007
by Dean J.
Updated: 29 May, 2018
by Gargani A.

Question

How do I add a label when a new point is added?

Answer

When using an IlvDefaultDataSet, you can add a point using the method addData(double x, double y, String label).

You also have two options depending on the type of label you want to set:

  • If the labels are static or cannot be evaluated dynamically, you can use setDataLabels(String[] labels) and set all labels at once.
  • If the labels can be computed at runtime, you can use the method setDataLabel(int idx, String label) or override the getDataLabel(int idx) method as follows:

    IlvDefaultDataSet dataSet = new IlvDefaultDataSet("Demo") {
    public java.lang.String getDataLabel(int idx) {
    if (idx > getDataCount()) {
    return "Undefined";
    }
    return "NE(" + idx + ")=" + getYData(idx);
    }
    };

This article was:   Helpful | Not helpful
Report an issue
Article ID: 2222
Last updated: 29 May, 2018
Revision: 3
Views: 743
Posted: 26 Oct, 2007 by Dean J.
Updated: 29 May, 2018 by Gargani A.
Also listed in


Others in this category