Search in sources :

Example 1 with GraphRowExactValues

use of kg.apc.charting.rows.GraphRowExactValues 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 GraphRowExactValues

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

the class GraphRowExactValuesTest method testSize.

@Test
public void testSize() {
    System.out.println("size");
    GraphRowExactValues instance = new GraphRowExactValues();
    int expResult = 0;
    int result = instance.size();
    Assert.assertEquals(expResult, result);
}
Also used : GraphRowExactValues(kg.apc.charting.rows.GraphRowExactValues)

Example 3 with GraphRowExactValues

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

the class GraphRowExactValuesTest method testGetElement.

/**
 * Test of getElement method, of class GraphRowExactValues.
 */
@Test
public void testGetElement() {
    System.out.println("getElement");
    long value = 100L;
    GraphRowExactValues instance = new GraphRowExactValues();
    AbstractGraphPanelChartElement expResult = new GraphPanelChartExactElement(value, 2);
    instance.add(value, 2);
    AbstractGraphPanelChartElement result = instance.getElement(value);
    Assert.assertTrue(instance.getElement(value).getValue() == expResult.getValue());
}
Also used : GraphPanelChartExactElement(kg.apc.charting.elements.GraphPanelChartExactElement) AbstractGraphPanelChartElement(kg.apc.charting.AbstractGraphPanelChartElement) GraphRowExactValues(kg.apc.charting.rows.GraphRowExactValues)

Example 4 with GraphRowExactValues

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

the class GraphRowExactValuesTest method testHasNext.

/**
 * Test of hasNext method, of class GraphRowExactValues.
 */
@Test
public void testHasNext() {
    System.out.println("hasNext");
    GraphRowExactValues instance = new GraphRowExactValues();
    boolean expResult = false;
    boolean result = instance.hasNext();
    Assert.assertEquals(expResult, result);
}
Also used : GraphRowExactValues(kg.apc.charting.rows.GraphRowExactValues)

Example 5 with GraphRowExactValues

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

the class GraphRowExactValuesTest method testIterator.

/**
 * Test of iterator method, of class GraphRowExactValues.
 */
@Test
public void testIterator() {
    System.out.println("iterator");
    GraphRowExactValues instance = new GraphRowExactValues();
    instance.add(1, 1);
    instance.add(1, 2);
    instance.add(1, 3);
    Iterator<Entry<Long, AbstractGraphPanelChartElement>> result = instance.iterator();
    assertEquals(1, ((AbstractGraphPanelChartElement) result.next().getValue()).getValue(), 0.001);
    assertEquals(2, ((AbstractGraphPanelChartElement) result.next().getValue()).getValue(), 0.001);
    assertEquals(3, ((AbstractGraphPanelChartElement) result.next().getValue()).getValue(), 0.001);
}
Also used : Entry(java.util.Map.Entry) 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