Search in sources :

Example 1 with JMeterVariableEvaluator

use of kg.apc.jmeter.JMeterVariableEvaluator in project jmeter-plugins by undera.

the class FreeFormArrivalsThreadGroupGui method updateChart.

protected void updateChart(AbstractDynamicThreadGroup tg) {
    FreeFormArrivalsThreadGroup atg = (FreeFormArrivalsThreadGroup) tg;
    CollectionProperty data = atg.getData();
    chartModel.clear();
    previewChart.clearErrorMessage();
    AbstractGraphRow row = new GraphRowExactValues();
    row.setColor(getRowColor());
    row.setDrawLine(true);
    row.setMarkerSize(AbstractGraphRow.MARKER_SIZE_NONE);
    row.setDrawThickLines(true);
    // initial value to force min Y
    row.add(0, 0);
    JMeterVariableEvaluator evaluator = new JMeterVariableEvaluator();
    int offset = 0;
    double totalArrivals = 0;
    PropertyIterator it = data.iterator();
    while (it.hasNext()) {
        CollectionProperty record = (CollectionProperty) it.next();
        double from = evaluator.getDouble(record.get(0));
        double to = evaluator.getDouble(record.get(1));
        double during = evaluator.getDouble(record.get(2));
        row.add(offset * 1000, from);
        offset += during * tg.getUnitFactor();
        row.add(offset * 1000, to);
        totalArrivals += during * from + during * (to - from) / 2;
    }
    previewChart.setxAxisLabelRenderer(new DateTimeRenderer(DateTimeRenderer.HHMMSS, 0));
    chartModel.put(getRowLabel(totalArrivals), row);
}
Also used : AbstractGraphRow(kg.apc.charting.AbstractGraphRow) CollectionProperty(org.apache.jmeter.testelement.property.CollectionProperty) DateTimeRenderer(kg.apc.charting.DateTimeRenderer) PropertyIterator(org.apache.jmeter.testelement.property.PropertyIterator) JMeterVariableEvaluator(kg.apc.jmeter.JMeterVariableEvaluator) GraphRowExactValues(kg.apc.charting.rows.GraphRowExactValues)

Example 2 with JMeterVariableEvaluator

use of kg.apc.jmeter.JMeterVariableEvaluator in project jmeter-plugins by undera.

the class AbstractDynamicThreadGroupGui method updateUI.

public void updateUI() {
    super.updateUI();
    if (!uiCreated) {
        log.debug("Won't update UI");
        return;
    }
    log.debug("Updating UI");
    AbstractDynamicThreadGroup atg = createThreadGroupObject();
    JMeterVariableEvaluator evaluator = new JMeterVariableEvaluator();
    loadFields.UItoModel(atg, evaluator);
    additionalFields.UItoModel(atg, evaluator);
    try {
        updateChart(atg);
    } catch (NumberFormatException e) {
        previewChart.setErrorMessage("The values entered cannot be rendered in preview...");
    } finally {
        setChartPropertiesFromTG(atg);
        previewChart.invalidateCache();
        previewChart.repaint();
    }
    if (loadFields instanceof LoadParamsFieldsPanel) {
        LoadParamsFieldsPanel panel = (LoadParamsFieldsPanel) loadFields;
        panel.changeUnitInLabels(atg.getUnit());
    }
}
Also used : JMeterVariableEvaluator(kg.apc.jmeter.JMeterVariableEvaluator)

Aggregations

JMeterVariableEvaluator (kg.apc.jmeter.JMeterVariableEvaluator)2 AbstractGraphRow (kg.apc.charting.AbstractGraphRow)1 DateTimeRenderer (kg.apc.charting.DateTimeRenderer)1 GraphRowExactValues (kg.apc.charting.rows.GraphRowExactValues)1 CollectionProperty (org.apache.jmeter.testelement.property.CollectionProperty)1 PropertyIterator (org.apache.jmeter.testelement.property.PropertyIterator)1