Search in sources :

Example 6 with ILineSeries

use of org.swtchart.ILineSeries in project linuxtools by eclipse.

the class ChartTests method testChartCallback.

@Test
public void testChartCallback() throws Exception {
    ILaunchConfiguration config = createConfiguration(proj.getProject());
    // $NON-NLS-1$
    doLaunch(config, "testChartCallback");
    IAction chartAction = getChartAction();
    assertNotNull(chartAction);
    chartAction.run();
    IEditorPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
    assertTrue(part instanceof ChartEditor);
    Chart control = ((ChartEditor) part).getControl();
    ILineSeries lsTotal = (ILineSeries) control.getSeriesSet().getSeries(// $NON-NLS-1$
    Messages.getString("HeapChart.Total_Heap"));
    Point p1 = lsTotal.getPixelCoordinates(4);
    HeapChart heapChart = ((ChartEditorInput) ((ChartEditor) part).getEditorInput()).getChart();
    int x = control.getAxisSet().getXAxis(0).getPixelCoordinate(heapChart.time[4]);
    int y = control.getAxisSet().getYAxis(0).getPixelCoordinate(heapChart.dataTotal[4]);
    assertEquals(x, p1.x);
    assertEquals(y, p1.y);
}
Also used : HeapChart(org.eclipse.linuxtools.internal.valgrind.massif.charting.HeapChart) ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) ChartEditor(org.eclipse.linuxtools.internal.valgrind.massif.charting.ChartEditor) IAction(org.eclipse.jface.action.IAction) ILineSeries(org.swtchart.ILineSeries) IEditorPart(org.eclipse.ui.IEditorPart) Point(org.eclipse.swt.graphics.Point) ChartEditorInput(org.eclipse.linuxtools.internal.valgrind.massif.charting.ChartEditorInput) Chart(org.swtchart.Chart) HeapChart(org.eclipse.linuxtools.internal.valgrind.massif.charting.HeapChart) Point(org.eclipse.swt.graphics.Point) Test(org.junit.Test)

Aggregations

ILineSeries (org.swtchart.ILineSeries)6 Point (org.eclipse.swt.graphics.Point)2 Chart (org.swtchart.Chart)2 ILaunchConfiguration (org.eclipse.debug.core.ILaunchConfiguration)1 IAction (org.eclipse.jface.action.IAction)1 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1 TableViewer (org.eclipse.jface.viewers.TableViewer)1 MassifSnapshot (org.eclipse.linuxtools.internal.valgrind.massif.MassifSnapshot)1 ChartEditor (org.eclipse.linuxtools.internal.valgrind.massif.charting.ChartEditor)1 ChartEditorInput (org.eclipse.linuxtools.internal.valgrind.massif.charting.ChartEditorInput)1 HeapChart (org.eclipse.linuxtools.internal.valgrind.massif.charting.HeapChart)1 MouseAdapter (org.eclipse.swt.events.MouseAdapter)1 MouseEvent (org.eclipse.swt.events.MouseEvent)1 Color (org.eclipse.swt.graphics.Color)1 Font (org.eclipse.swt.graphics.Font)1 FontData (org.eclipse.swt.graphics.FontData)1 IEditorPart (org.eclipse.ui.IEditorPart)1 Test (org.junit.Test)1 IAxis (org.swtchart.IAxis)1 IAxisSet (org.swtchart.IAxisSet)1