diff options
author | Otavio Pontes | 2012-04-18 21:02:30 +0000 |
---|---|---|
committer | Otavio Pontes | 2012-04-18 21:02:30 +0000 |
commit | 611d7fd4e753f4b6a6a23aae5bc72e988fef8960 (patch) | |
tree | fa67155f61e1768d3ed74955aa832f9e3cca8ec2 /systemtap | |
parent | 3ea650c3772513266f1685d1e7a6fc8b04b72d8f (diff) | |
download | org.eclipse.linuxtools-611d7fd4e753f4b6a6a23aae5bc72e988fef8960.tar.gz org.eclipse.linuxtools-611d7fd4e753f4b6a6a23aae5bc72e988fef8960.tar.xz org.eclipse.linuxtools-611d7fd4e753f4b6a6a23aae5bc72e988fef8960.zip |
Systemtap: Use the maxItems and viewableItens preferences to draw the charts
Diffstat (limited to 'systemtap')
2 files changed, 20 insertions, 7 deletions
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/ui/graphingapi/ui/charts/AbstractChartBuilder.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/ui/graphingapi/ui/charts/AbstractChartBuilder.java index 3a3a0cf755..2e93af8132 100644 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/ui/graphingapi/ui/charts/AbstractChartBuilder.java +++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/ui/graphingapi/ui/charts/AbstractChartBuilder.java @@ -13,6 +13,11 @@ */ package org.eclipse.linuxtools.systemtap.ui.graphingapi.ui.charts; +import org.eclipse.jface.preference.IPreferenceStore; + +import org.eclipse.linuxtools.internal.systemtap.ui.graphingapi.ui.GraphingAPIUIPlugin; +import org.eclipse.linuxtools.systemtap.ui.graphingapi.ui.preferences.GraphingAPIPreferenceConstants; + import org.eclipse.swt.graphics.Color; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.SWT; @@ -35,6 +40,7 @@ public abstract class AbstractChartBuilder extends Composite implements IUpdateL * Font name for all titles, labels, and values. */ protected final static String FONT_NAME = "MS Sans Serif"; + protected int maxItems; /** * Provides data for chart. @@ -103,6 +109,9 @@ public abstract class AbstractChartBuilder extends Composite implements IUpdateL */ protected void createChart() { this.chart = new Chart(this, getStyle()); + IPreferenceStore store = GraphingAPIUIPlugin.getDefault().getPreferenceStore(); + maxItems = Math.min(store.getInt(GraphingAPIPreferenceConstants.P_VIEWABLE_DATA_ITEMS), + store.getInt(GraphingAPIPreferenceConstants.P_MAX_DATA_ITEMS)); } /** diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/ui/graphingapi/ui/charts/AbstractChartWithAxisBuilder.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/ui/graphingapi/ui/charts/AbstractChartWithAxisBuilder.java index c77c835962..9d7371f842 100644 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/ui/graphingapi/ui/charts/AbstractChartWithAxisBuilder.java +++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/ui/graphingapi/ui/charts/AbstractChartWithAxisBuilder.java @@ -69,19 +69,23 @@ public abstract class AbstractChartWithAxisBuilder extends AbstractChartBuilder if (data == null || data.length == 0) return; - double[] valx = new double[data.length]; - double[][] valy = new double[data[0].length-1][data.length]; + int start = 0, len = Math.min(this.maxItems, data.length); + if (this.maxItems < data.length) { + start = data.length - this.maxItems; + } + double[] valx = new double[len]; + double[][] valy = new double[data[0].length-1][len]; - for (int i = 0; i < data.length; i++) - for (int j = 0; j < data[i].length; j++) { + ISeries allSeries[] = chart.getSeriesSet().getSeries(); + for (int i = 0; i < valx.length; i++) + for (int j = 0; j < data[start + i].length; j++) { if (j == 0) - valx[i] = getDoubleValue(data[i][j]); + valx[i] = getDoubleValue(data[start + i][j]); else - valy[j-1][i] = getDoubleValue(data[i][j]); + valy[j-1][i] = getDoubleValue(data[start + i][j]); } - ISeries allSeries[] = chart.getSeriesSet().getSeries(); for (int i = 0; i < valy.length; i++) { ISeries series; if (i >= allSeries.length) { |