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);
}
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());
}
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();
}
Aggregations