2
votes

My vizframe has multiple Measures. I want to have 1 reference line for each measure.

How can I add more than 1 reference line to the chart using setVizProperties?

current code which adding 1 reference line

var oChart = sap.ui.getCore().byId("mainPageView--idVizFrame");

oChart.setVizProperties({
    plotArea: {
        dataLabel: {
            visible: true
        },
        referenceLine: {
            line: {
                valueAxis: [{
                    value: value1,
                    visible: show,
                    size: 1,
                    type: "dotted",
                    label: {
                        text: "Target:" + value1 + strrange,
                        visible: show
                    }
                }]
            }
        }

    }
});
1

1 Answers

1
votes

the following code solves this issue

var RefLines2 = [];
var TargetValues = [40, 50, 60, 70];
for (var i = 0; i < TargetValues.length; i++) {

    RefLines2.push({

            value: TargetValues[i],
            visible: show,
            size: 1,
            type: "dotted",
            label: {
                text: "Target:" + TargetValues[i] + strrange,
                visible: show
            }

        }

    );
}

oChart.setVizProperties({
    plotArea: {
        dataLabel: {
            visible: true
        },
        referenceLine: {
            line: {
                valueAxis: RefLines2
            }

        }

    }
});