Search in sources :

Example 6 with GraphRowExactValues

use of kg.apc.charting.rows.GraphRowExactValues in project jmeter-plugins by undera.

the class GraphRowExactValuesTest method testNext.

/**
 * Test of next method, of class GraphRowExactValues.
 */
@Test
public void testNext() {
    System.out.println("next");
    GraphRowExactValues instance = new GraphRowExactValues();
    instance.add(1, 1);
    Iterator it = instance.iterator();
    Entry result = (Entry) it.next();
    Assert.assertEquals(1L, result.getKey());
}
Also used : Entry(java.util.Map.Entry) Iterator(java.util.Iterator) GraphRowExactValues(kg.apc.charting.rows.GraphRowExactValues)

Example 7 with GraphRowExactValues

use of kg.apc.charting.rows.GraphRowExactValues in project jmeter-plugins by undera.

the class VariableThroughputTimerGui method updateChart.

private void updateChart(VariableThroughputTimer tg) {
    model.clear();
    chart.clearErrorMessage();
    AbstractGraphRow row = new GraphRowExactValues();
    row.setColor(Color.BLUE);
    row.setDrawLine(true);
    row.setMarkerSize(AbstractGraphRow.MARKER_SIZE_NONE);
    row.setDrawThickLines(true);
    long now = System.currentTimeMillis();
    int rowsCount = tableModel.getRowCount();
    row.add(now, 0);
    row.add(now, tg.getRPSForSecond(0).getLeft());
    int duration = 0;
    for (int i = 0; i < rowsCount; i++) {
        row.add(now + (duration + 1) * 1000, tg.getRPSForSecond(duration + 1).getLeft());
        int rowVal = getIntFromRow(i, 2);
        if (rowVal < 0) {
            chart.setErrorMessage("The values entered cannot be rendered in preview...");
            break;
        }
        duration = duration + rowVal;
        row.add(now + duration * 1000, tg.getRPSForSecond(duration).getLeft());
    }
    // -1 because row.add(thread.getStartTime() - 1, 0)
    chart.setxAxisLabelRenderer(new DateTimeRenderer(DateTimeRenderer.HHMMSS, now - 1));
    chart.setForcedMinX(now);
    model.put("Expected RPS", row);
    chart.invalidateCache();
    chart.repaint();
}
Also used : AbstractGraphRow(kg.apc.charting.AbstractGraphRow) DateTimeRenderer(kg.apc.charting.DateTimeRenderer) GraphRowExactValues(kg.apc.charting.rows.GraphRowExactValues)

Example 8 with GraphRowExactValues

use of kg.apc.charting.rows.GraphRowExactValues in project jmeter-plugins by undera.

the class AbstractDynamicThreadGroupGui method updateChart.

protected void updateChart(AbstractDynamicThreadGroup atg) {
    double targetRate = atg.getTargetLevelAsDouble();
    long rampUp = atg.getRampUpSeconds();
    long holdFor = atg.getHoldSeconds();
    long stepsCount = atg.getStepsAsLong();
    double unitFactor = atg.getUnitFactor();
    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);
    double totalArrivals = 0;
    if (stepsCount > 0) {
        double stepSize = targetRate / (double) stepsCount;
        double stepLen = rampUp / (double) stepsCount;
        for (int n = 1; n <= stepsCount; n++) {
            double stepRate = stepSize * n;
            row.add(Math.round((n - 1) * stepLen * 1000), stepRate);
            row.add(Math.round(n * stepLen * 1000), stepRate);
            totalArrivals += stepLen * stepRate;
        }
    } else {
        row.add(rampUp * 1000, targetRate);
        totalArrivals += rampUp * targetRate / 2.0;
    }
    row.add((rampUp + holdFor) * 1000, targetRate);
    totalArrivals += holdFor * targetRate;
    totalArrivals /= unitFactor;
    previewChart.setxAxisLabelRenderer(new DateTimeRenderer(DateTimeRenderer.HHMMSS, 0));
    chartModel.put(getRowLabel(totalArrivals), row);
}
Also used : AbstractGraphRow(kg.apc.charting.AbstractGraphRow) DateTimeRenderer(kg.apc.charting.DateTimeRenderer) GraphRowExactValues(kg.apc.charting.rows.GraphRowExactValues)

Example 9 with GraphRowExactValues

use of kg.apc.charting.rows.GraphRowExactValues in project jmeter-plugins by undera.

the class GraphRowExactValuesTest method testAdd.

/**
 * Test of add method, of class GraphRowExactValues.
 */
@Test
public void testAdd() {
    System.out.println("add");
    long xVal = 0L;
    GraphRowExactValues instance = new GraphRowExactValues();
    instance.add(xVal, 1);
    instance.add(xVal, 2);
    instance.add(xVal, 3);
}
Also used : GraphRowExactValues(kg.apc.charting.rows.GraphRowExactValues)

Example 10 with GraphRowExactValues

use of kg.apc.charting.rows.GraphRowExactValues in project jmeter-plugins by undera.

the class GraphRowExactValuesTest method testRemove.

/**
 * Test of remove method, of class GraphRowExactValues.
 */
@Test
public void testRemove() {
    System.out.println("remove");
    GraphRowExactValues instance = new GraphRowExactValues();
    try {
        instance.remove();
        Assert.fail("Exception expected");
    } catch (UnsupportedOperationException e) {
    }
}
Also used : GraphRowExactValues(kg.apc.charting.rows.GraphRowExactValues)

Aggregations

GraphRowExactValues (kg.apc.charting.rows.GraphRowExactValues)10 AbstractGraphRow (kg.apc.charting.AbstractGraphRow)3 DateTimeRenderer (kg.apc.charting.DateTimeRenderer)3 Entry (java.util.Map.Entry)2 Iterator (java.util.Iterator)1 AbstractGraphPanelChartElement (kg.apc.charting.AbstractGraphPanelChartElement)1 GraphPanelChartExactElement (kg.apc.charting.elements.GraphPanelChartExactElement)1 JMeterVariableEvaluator (kg.apc.jmeter.JMeterVariableEvaluator)1 CollectionProperty (org.apache.jmeter.testelement.property.CollectionProperty)1 PropertyIterator (org.apache.jmeter.testelement.property.PropertyIterator)1