Search in sources :

Example 1 with ChartModel

use of org.eclipse.tracecompass.internal.provisional.tmf.chart.core.chart.ChartModel in project tracecompass by tracecompass.

the class LamiReportViewTabPage method createNewCustomChart.

// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
/**
 * This method is used for creating a chart from the result table of the
 * analyse. It uses the custom charts plugin to configure and create the
 * chart.
 */
public void createNewCustomChart() {
    Shell shell = this.getControl().getShell();
    if (shell == null) {
        return;
    }
    /* Open the chart maker dialog */
    ChartMakerDialog dialog = new ChartMakerDialog(shell, fResultTable);
    if (dialog.open() != Window.OK) {
        return;
    }
    /* Make sure the data for making a chart was generated */
    ChartData data = dialog.getDataSeries();
    ChartModel model = dialog.getChartModel();
    if (data == null || model == null) {
        return;
    }
    /* Make a chart with the factory constructor */
    LamiViewerControl viewerControl = new LamiViewerControl(fControl, data, model);
    fCustomGraphViewerControls.add(viewerControl);
    viewerControl.getToggleAction().run();
    /* Signal the current selection to the newly created graph */
    ChartSelectionUpdateSignal signal = new ChartSelectionUpdateSignal(LamiReportViewTabPage.this, fResultTable, fSelection);
    TmfSignalManager.dispatchSignal(signal);
}
Also used : Shell(org.eclipse.swt.widgets.Shell) ChartData(org.eclipse.tracecompass.internal.provisional.tmf.chart.core.chart.ChartData) ChartSelectionUpdateSignal(org.eclipse.tracecompass.internal.provisional.tmf.chart.core.signal.ChartSelectionUpdateSignal) ChartModel(org.eclipse.tracecompass.internal.provisional.tmf.chart.core.chart.ChartModel) ChartMakerDialog(org.eclipse.tracecompass.internal.provisional.tmf.chart.ui.dialog.ChartMakerDialog)

Example 2 with ChartModel

use of org.eclipse.tracecompass.internal.provisional.tmf.chart.core.chart.ChartModel in project tracecompass by tracecompass.

the class ChartModelTest method testConstructor.

/**
 * Test constructor of the class
 */
@Test
public void testConstructor() {
    // Normal title and x and y log scales
    String title = "title";
    ChartModel cm = new ChartModel(ChartType.BAR_CHART, title, true, true);
    assertEquals(ChartType.BAR_CHART, cm.getChartType());
    assertEquals(title, cm.getTitle());
    assertTrue(cm.isXLogscale());
    assertTrue(cm.isYLogscale());
    // Title with accented characters, y log scale, but not x log scale
    title = "éèëâ\nbla";
    cm = new ChartModel(ChartType.SCATTER_CHART, title, false, true);
    assertEquals(ChartType.SCATTER_CHART, cm.getChartType());
    assertEquals(title, cm.getTitle());
    assertFalse(cm.isXLogscale());
    assertTrue(cm.isYLogscale());
    // Title with special characters, no log scale
    title = "&?%$/\"()";
    cm = new ChartModel(ChartType.PIE_CHART, title, false, false);
    assertEquals(ChartType.PIE_CHART, cm.getChartType());
    assertEquals(title, cm.getTitle());
    assertFalse(cm.isXLogscale());
    assertFalse(cm.isYLogscale());
}
Also used : ChartModel(org.eclipse.tracecompass.internal.provisional.tmf.chart.core.chart.ChartModel) Test(org.junit.Test)

Example 3 with ChartModel

use of org.eclipse.tracecompass.internal.provisional.tmf.chart.core.chart.ChartModel in project tracecompass by tracecompass.

the class ChartMakerDialog method okPressed.

@Override
public void okPressed() {
    /* Create the data series */
    fDataSeries = new ChartData(fDataProvider, fSelectedSeries);
    /* Create the data model */
    ChartType type = checkNotNull(checkNotNull(fType).getType());
    String title = fDataProvider.getName();
    boolean xlog = fXLogscaleButton.getSelection();
    boolean ylog = fYLogscaleButton.getSelection();
    fChartModel = new ChartModel(type, title, xlog, ylog);
    super.okPressed();
}
Also used : ChartData(org.eclipse.tracecompass.internal.provisional.tmf.chart.core.chart.ChartData) ChartType(org.eclipse.tracecompass.internal.provisional.tmf.chart.core.chart.ChartType) ChartModel(org.eclipse.tracecompass.internal.provisional.tmf.chart.core.chart.ChartModel)

Aggregations

ChartModel (org.eclipse.tracecompass.internal.provisional.tmf.chart.core.chart.ChartModel)3 ChartData (org.eclipse.tracecompass.internal.provisional.tmf.chart.core.chart.ChartData)2 Shell (org.eclipse.swt.widgets.Shell)1 ChartType (org.eclipse.tracecompass.internal.provisional.tmf.chart.core.chart.ChartType)1 ChartSelectionUpdateSignal (org.eclipse.tracecompass.internal.provisional.tmf.chart.core.signal.ChartSelectionUpdateSignal)1 ChartMakerDialog (org.eclipse.tracecompass.internal.provisional.tmf.chart.ui.dialog.ChartMakerDialog)1 Test (org.junit.Test)1