2251: Accounting Manager - Stacked column chart for tops
Task-Url: https://support.d4science.org/issues/2251 Updated Stacked Chart for Service git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/admin/accounting-manager@124385 82a268e6-3cf1-43bd-a215-b396298e98cf
|
@ -5,6 +5,7 @@ import java.util.Date;
|
|||
import org.gcube.portlets.admin.accountingmanager.client.maindata.charts.utils.ChartTimeMeasure;
|
||||
import org.gcube.portlets.admin.accountingmanager.client.maindata.charts.utils.DownloadConstants;
|
||||
import org.gcube.portlets.admin.accountingmanager.client.maindata.charts.utils.JobChartMeasure;
|
||||
import org.gcube.portlets.admin.accountingmanager.client.maindata.charts.utils.TimeUnitMeasure;
|
||||
import org.gcube.portlets.admin.accountingmanager.client.resource.AccountingManagerResources;
|
||||
import org.gcube.portlets.admin.accountingmanager.client.state.AccountingStateData;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesJob;
|
||||
|
@ -48,9 +49,11 @@ import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
|
|||
*
|
||||
*/
|
||||
public class JobChartBasicPanel extends SimpleContainer {
|
||||
private DateTimeFormat dtf=DateTimeFormat.getFormat(PredefinedFormat.YEAR_MONTH_DAY);
|
||||
|
||||
private DateTimeFormat dtf = DateTimeFormat
|
||||
.getFormat(PredefinedFormat.YEAR_MONTH_DAY);
|
||||
private static final String TIME_UNIT = "Time Unit";
|
||||
private static final String SINGLE_AXIS = "Single Axis";
|
||||
|
||||
private AccountingStateData accountingStateData;
|
||||
private HighchartsLayoutPanel highchartsLayoutPanel;
|
||||
|
||||
|
@ -59,9 +62,20 @@ public class JobChartBasicPanel extends SimpleContainer {
|
|||
private MenuItem downloadJPGItem;
|
||||
private MenuItem downloadPDFItem;
|
||||
private MenuItem downloadSVGItem;
|
||||
|
||||
|
||||
|
||||
// Time Unit Menu
|
||||
private MenuItem msItem;
|
||||
private MenuItem sItem;
|
||||
private MenuItem mItem;
|
||||
private MenuItem hItem;
|
||||
|
||||
private ChartOptions options;
|
||||
private VerticalLayoutContainer vert;
|
||||
|
||||
private long unitMeasure = TimeUnitMeasure.getMilliseconds();
|
||||
private String unitMeasureLabel = TimeUnitMeasure.MS;
|
||||
private TextButton unitButton;
|
||||
private ToggleButton toggleButton;
|
||||
|
||||
public JobChartBasicPanel(AccountingStateData accountingStateData) {
|
||||
this.accountingStateData = accountingStateData;
|
||||
|
@ -74,18 +88,22 @@ public class JobChartBasicPanel extends SimpleContainer {
|
|||
ToolBar toolBar = new ToolBar();
|
||||
toolBar.setSpacing(2);
|
||||
// Download
|
||||
final TextButton downloadButton = new TextButton(DownloadConstants.DOWNLOAD,
|
||||
AccountingManagerResources.INSTANCE
|
||||
.accountingDownload24());
|
||||
final TextButton downloadButton = new TextButton(
|
||||
DownloadConstants.DOWNLOAD,
|
||||
AccountingManagerResources.INSTANCE.accountingDownload24());
|
||||
// downloadButton.setScale(ButtonScale.MEDIUM);
|
||||
downloadButton.setIconAlign(IconAlign.RIGHT);
|
||||
downloadButton.setArrowAlign(ButtonArrowAlign.RIGHT);
|
||||
downloadButton.setMenu(createDownloadMenu());
|
||||
|
||||
toolBar.add(downloadButton, new BoxLayoutData(new Margins(0)));
|
||||
unitButton = new TextButton(TIME_UNIT,
|
||||
AccountingManagerResources.INSTANCE.accountingUnitms24());
|
||||
unitButton.setIconAlign(IconAlign.RIGHT);
|
||||
unitButton.setArrowAlign(ButtonArrowAlign.RIGHT);
|
||||
unitButton.setMenu(createUnitMenu());
|
||||
|
||||
// Single Axis
|
||||
final ToggleButton toggleButton = new ToggleButton(SINGLE_AXIS);
|
||||
toggleButton = new ToggleButton(SINGLE_AXIS);
|
||||
toggleButton.setIcon(AccountingManagerResources.INSTANCE
|
||||
.accountingChartVariableAxis24());
|
||||
toggleButton.setIconAlign(IconAlign.RIGHT);
|
||||
|
@ -95,27 +113,22 @@ public class JobChartBasicPanel extends SimpleContainer {
|
|||
|
||||
@Override
|
||||
public void onSelect(SelectEvent event) {
|
||||
if (toggleButton.getValue()) {
|
||||
createSingleAxisChart();
|
||||
highchartsLayoutPanel.renderChart(options);
|
||||
} else {
|
||||
createMultiAxisChart();
|
||||
highchartsLayoutPanel.renderChart(options);
|
||||
}
|
||||
forceLayout();
|
||||
updateChart();
|
||||
}
|
||||
});
|
||||
|
||||
//toolBar.add(toggleButton, new BoxLayoutData(new Margins(0)));
|
||||
toolBar.add(downloadButton, new BoxLayoutData(new Margins(0)));
|
||||
toolBar.add(unitButton, new BoxLayoutData(new Margins(0)));
|
||||
toolBar.add(toggleButton, new BoxLayoutData(new Margins(0)));
|
||||
|
||||
//
|
||||
createMultiAxisChart();
|
||||
|
||||
|
||||
highchartsLayoutPanel = new HighchartsLayoutPanel();
|
||||
highchartsLayoutPanel.renderChart(options);
|
||||
|
||||
//
|
||||
VerticalLayoutContainer vert = new VerticalLayoutContainer();
|
||||
vert = new VerticalLayoutContainer();
|
||||
vert.add(toolBar, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
vert.add(highchartsLayoutPanel, new VerticalLayoutData(1, 1,
|
||||
new Margins(0)));
|
||||
|
@ -124,26 +137,103 @@ public class JobChartBasicPanel extends SimpleContainer {
|
|||
|
||||
}
|
||||
|
||||
private void updateChart() {
|
||||
if (toggleButton.getValue()) {
|
||||
createSingleAxisChart();
|
||||
highchartsLayoutPanel.renderChart(options);
|
||||
} else {
|
||||
createMultiAxisChart();
|
||||
highchartsLayoutPanel.renderChart(options);
|
||||
}
|
||||
forceLayout();
|
||||
}
|
||||
|
||||
private Menu createUnitMenu() {
|
||||
Menu menuUnit = new Menu();
|
||||
msItem = new MenuItem(TimeUnitMeasure.MILLISECONDS,
|
||||
AccountingManagerResources.INSTANCE.accountingUnitms24());
|
||||
msItem.setHeight(30);
|
||||
sItem = new MenuItem(TimeUnitMeasure.SECONDS,
|
||||
AccountingManagerResources.INSTANCE.accountingUnits24());
|
||||
sItem.setHeight(30);
|
||||
mItem = new MenuItem(TimeUnitMeasure.MINUTES,
|
||||
AccountingManagerResources.INSTANCE.accountingUnitm24());
|
||||
mItem.setHeight(30);
|
||||
hItem = new MenuItem(TimeUnitMeasure.HOURS,
|
||||
AccountingManagerResources.INSTANCE.accountingUnith24());
|
||||
hItem.setHeight(30);
|
||||
|
||||
msItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
|
||||
@Override
|
||||
public void onSelection(SelectionEvent<Item> event) {
|
||||
unitMeasure = TimeUnitMeasure.getMilliseconds();
|
||||
unitMeasureLabel = TimeUnitMeasure.MS;
|
||||
unitButton.setIcon(AccountingManagerResources.INSTANCE
|
||||
.accountingUnitms24());
|
||||
updateChart();
|
||||
}
|
||||
});
|
||||
|
||||
sItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
|
||||
@Override
|
||||
public void onSelection(SelectionEvent<Item> event) {
|
||||
unitMeasure = TimeUnitMeasure.getSeconds();
|
||||
unitMeasureLabel = TimeUnitMeasure.S;
|
||||
unitButton.setIcon(AccountingManagerResources.INSTANCE
|
||||
.accountingUnits24());
|
||||
updateChart();
|
||||
}
|
||||
});
|
||||
|
||||
mItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
|
||||
@Override
|
||||
public void onSelection(SelectionEvent<Item> event) {
|
||||
unitMeasure = TimeUnitMeasure.getMinutes();
|
||||
unitMeasureLabel = TimeUnitMeasure.M;
|
||||
unitButton.setIcon(AccountingManagerResources.INSTANCE
|
||||
.accountingUnitm24());
|
||||
updateChart();
|
||||
}
|
||||
});
|
||||
|
||||
hItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
|
||||
@Override
|
||||
public void onSelection(SelectionEvent<Item> event) {
|
||||
unitMeasure = TimeUnitMeasure.getHours();
|
||||
unitMeasureLabel = TimeUnitMeasure.H;
|
||||
unitButton.setIcon(AccountingManagerResources.INSTANCE
|
||||
.accountingUnith24());
|
||||
updateChart();
|
||||
}
|
||||
});
|
||||
|
||||
menuUnit.add(msItem);
|
||||
menuUnit.add(sItem);
|
||||
menuUnit.add(mItem);
|
||||
menuUnit.add(hItem);
|
||||
return menuUnit;
|
||||
|
||||
}
|
||||
|
||||
private Menu createDownloadMenu() {
|
||||
|
||||
Menu menuDownload = new Menu();
|
||||
downloadPNGItem = new MenuItem(DownloadConstants.DOWNLOAD_PNG,
|
||||
AccountingManagerResources.INSTANCE
|
||||
.accountingFilePNG24());
|
||||
AccountingManagerResources.INSTANCE.accountingFilePNG24());
|
||||
downloadPNGItem.setHeight(30);
|
||||
downloadJPGItem = new MenuItem(DownloadConstants.DOWNLOAD_JPG,
|
||||
AccountingManagerResources.INSTANCE
|
||||
.accountingFileJPG24());
|
||||
AccountingManagerResources.INSTANCE.accountingFileJPG24());
|
||||
downloadJPGItem.setHeight(30);
|
||||
downloadPDFItem = new MenuItem(DownloadConstants.DOWNLOAD_PDF,
|
||||
AccountingManagerResources.INSTANCE
|
||||
.accountingFilePDF24());
|
||||
AccountingManagerResources.INSTANCE.accountingFilePDF24());
|
||||
downloadPDFItem.setHeight(30);
|
||||
downloadSVGItem = new MenuItem(DownloadConstants.DOWNLOAD_SVG,
|
||||
AccountingManagerResources.INSTANCE
|
||||
.accountingFileSVG24());
|
||||
AccountingManagerResources.INSTANCE.accountingFileSVG24());
|
||||
downloadSVGItem.setHeight(30);
|
||||
|
||||
|
||||
downloadPNGItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
|
||||
|
@ -245,11 +335,13 @@ public class JobChartBasicPanel extends SimpleContainer {
|
|||
private void createMultiAxisChart() {
|
||||
SeriesJob seriesJob = (SeriesJob) accountingStateData
|
||||
.getSeriesResponse();
|
||||
if(!(seriesJob.getSeriesJobDefinition() instanceof SeriesJobBasic)){
|
||||
//throw new Exception("Invalid SeriesServiceBasic!");
|
||||
|
||||
if (!(seriesJob.getSeriesJobDefinition() instanceof SeriesJobBasic)) {
|
||||
Log.error("Invalid SeriesJobBasic!");
|
||||
return;
|
||||
}
|
||||
SeriesJobBasic seriesJobBasic=(SeriesJobBasic)seriesJob.getSeriesJobDefinition();
|
||||
SeriesJobBasic seriesJobBasic = (SeriesJobBasic) seriesJob
|
||||
.getSeriesJobDefinition();
|
||||
|
||||
double minRange = ChartTimeMeasure
|
||||
.calculateMinRange(accountingStateData.getSeriesRequest()
|
||||
|
@ -258,10 +350,10 @@ public class JobChartBasicPanel extends SimpleContainer {
|
|||
double interval = ChartTimeMeasure
|
||||
.calculateInterval(accountingStateData.getSeriesRequest()
|
||||
.getAccountingPeriod());
|
||||
|
||||
Date dateStart=dtf.parse(accountingStateData.getSeriesRequest()
|
||||
|
||||
Date dateStart = dtf.parse(accountingStateData.getSeriesRequest()
|
||||
.getAccountingPeriod().getStartDate());
|
||||
|
||||
|
||||
dateStart.setTime(dateStart.getTime()
|
||||
+ ChartTimeMeasure.timeZoneOffset() * ChartTimeMeasure.MINUTE);
|
||||
|
||||
|
@ -271,11 +363,9 @@ public class JobChartBasicPanel extends SimpleContainer {
|
|||
|
||||
HighchartsOptionFactory highchartsFactory = new JsoHighchartsOptionFactory();
|
||||
options = highchartsFactory.createChartOptions();
|
||||
|
||||
options.chart().zoomType("xy");
|
||||
options.navigation().buttonOptions().enabled(false);
|
||||
options.exporting().filename("AccountingJobBasic");
|
||||
options.chart().zoomType("xy");
|
||||
|
||||
options.title().text("Accounting Job");
|
||||
|
||||
/*
|
||||
|
@ -290,80 +380,41 @@ public class JobChartBasicPanel extends SimpleContainer {
|
|||
options.xAxis().type("datetime").minRange(minRange);
|
||||
|
||||
// yAxis
|
||||
String multiAxis = "[{" + " \"id\": \""+JobChartMeasure.OperationCount.name()+"\","
|
||||
String multiAxis = "[{" + " \"id\": \""
|
||||
+ JobChartMeasure.OperationCount.name() + "\","
|
||||
+ " \"labels\": { " + " \"format\": \"{value}\","
|
||||
+ " \"style\": { " + " \"color\": \""
|
||||
+ colors.get(1)
|
||||
+ "\""
|
||||
+ " }"
|
||||
+ " },"
|
||||
+ " \"title\": { "
|
||||
+ " \"text\": \""+JobChartMeasure.OperationCount.getLabel()+"\","
|
||||
+ " \"style\": {"
|
||||
+ " \"color\": \""
|
||||
+ colors.get(1)
|
||||
+ "\""
|
||||
+ " }"
|
||||
+ " }"
|
||||
+ "} , {"
|
||||
+ " \"id\": \""+JobChartMeasure.Duration.name()+"\", "
|
||||
+ " \"title\": {"
|
||||
+ " \"text\": \""+JobChartMeasure.Duration.getLabel()+"\","
|
||||
+ " \"style\": {"
|
||||
+ " \"color\": \""
|
||||
+ colors.get(0)
|
||||
+ "\""
|
||||
+ " }"
|
||||
+ " },"
|
||||
+ " \"labels\": {"
|
||||
+ " \"format\": \"{value} ms\","
|
||||
+ " \"style\": {"
|
||||
+ " \"color\": \""
|
||||
+ colors.get(0)
|
||||
+ "\""
|
||||
+ " }"
|
||||
+ " },"
|
||||
+ " \"opposite\": \"true\""
|
||||
+ ", \"showFirstLabel\": \"false\""
|
||||
+ "} , {"
|
||||
+ " \"id\": \""+JobChartMeasure.MaxInvocationTime.name()+"\", "
|
||||
+ " \"title\": {"
|
||||
+ " \"text\": \""+JobChartMeasure.MaxInvocationTime.getLabel()+"\","
|
||||
+ " \"style\": {"
|
||||
+ " \"color\": \""
|
||||
+ colors.get(2)
|
||||
+ "\""
|
||||
+ " }"
|
||||
+ " },"
|
||||
+ " \"labels\": {"
|
||||
+ " \"format\": \"{value} ms\","
|
||||
+ " \"style\": {"
|
||||
+ " \"color\": \""
|
||||
+ colors.get(2)
|
||||
+ "\""
|
||||
+ " }"
|
||||
+ " },"
|
||||
+ " \"opposite\": \"true\""
|
||||
+ ", \"showFirstLabel\": \"false\""
|
||||
+ "} , {"
|
||||
+ " \"id\": \""+JobChartMeasure.MinInvocationTime.name()+"\", "
|
||||
+ " \"title\": {"
|
||||
+ " \"text\": \""+JobChartMeasure.MinInvocationTime.getLabel()+"\","
|
||||
+ " \"style\": {"
|
||||
+ " \"color\": \""
|
||||
+ colors.get(3)
|
||||
+ "\""
|
||||
+ " }"
|
||||
+ " },"
|
||||
+ " \"labels\": {"
|
||||
+ " \"format\": \"{value} ms\","
|
||||
+ " \"style\": {"
|
||||
+ " \"color\": \""
|
||||
+ colors.get(3)
|
||||
+ "\""
|
||||
+ " }"
|
||||
+ " },"
|
||||
+ " \"opposite\": \"true\""
|
||||
+ " \"style\": { " + " \"color\": \"" + colors.get(1)
|
||||
+ "\"" + " }" + " }," + " \"title\": { "
|
||||
+ " \"text\": \""
|
||||
+ JobChartMeasure.OperationCount.getLabel() + "\","
|
||||
+ " \"style\": {" + " \"color\": \"" + colors.get(1)
|
||||
+ "\"" + " }" + " }" + "} , {" + " \"id\": \""
|
||||
+ JobChartMeasure.Duration.name() + "\", "
|
||||
+ " \"title\": {" + " \"text\": \""
|
||||
+ JobChartMeasure.Duration.getLabel() + "\","
|
||||
+ " \"style\": {" + " \"color\": \"" + colors.get(0)
|
||||
+ "\"" + " }" + " }," + " \"labels\": {"
|
||||
+ " \"format\": \"{value} " + unitMeasureLabel + "\","
|
||||
+ " \"style\": {" + " \"color\": \"" + colors.get(0)
|
||||
+ "\"" + " }" + " }," + " \"opposite\": \"true\""
|
||||
+ ", \"showFirstLabel\": \"false\"" + "} , {" + " \"id\": \""
|
||||
+ JobChartMeasure.MaxInvocationTime.name() + "\", "
|
||||
+ " \"title\": {" + " \"text\": \""
|
||||
+ JobChartMeasure.MaxInvocationTime.getLabel() + "\","
|
||||
+ " \"style\": {" + " \"color\": \"" + colors.get(2)
|
||||
+ "\"" + " }" + " }," + " \"labels\": {"
|
||||
+ " \"format\": \"{value} " + unitMeasureLabel + "\","
|
||||
+ " \"style\": {" + " \"color\": \"" + colors.get(2)
|
||||
+ "\"" + " }" + " }," + " \"opposite\": \"true\""
|
||||
+ ", \"showFirstLabel\": \"false\"" + "} , {" + " \"id\": \""
|
||||
+ JobChartMeasure.MinInvocationTime.name() + "\", "
|
||||
+ " \"title\": {" + " \"text\": \""
|
||||
+ JobChartMeasure.MinInvocationTime.getLabel() + "\","
|
||||
+ " \"style\": {" + " \"color\": \"" + colors.get(3)
|
||||
+ "\"" + " }" + " }," + " \"labels\": {"
|
||||
+ " \"format\": \"{value} " + unitMeasureLabel + "\","
|
||||
+ " \"style\": {" + " \"color\": \"" + colors.get(3)
|
||||
+ "\"" + " }" + " }," + " \"opposite\": \"true\""
|
||||
+ ", \"showFirstLabel\": \"false\"" + "}]"
|
||||
|
||||
;
|
||||
|
@ -382,7 +433,8 @@ public class JobChartBasicPanel extends SimpleContainer {
|
|||
|
||||
SeriesColumn seriesOperationCount = highchartsFactory
|
||||
.createSeriesColumn();
|
||||
seriesOperationCount.name(JobChartMeasure.OperationCount.getLabel());
|
||||
seriesOperationCount
|
||||
.name(JobChartMeasure.OperationCount.getLabel());
|
||||
seriesOperationCount.color(colors.get(1));
|
||||
seriesOperationCount.type("column");
|
||||
|
||||
|
@ -403,9 +455,11 @@ public class JobChartBasicPanel extends SimpleContainer {
|
|||
|
||||
SeriesArea seriesMaxInvocationTime = highchartsFactory
|
||||
.createSeriesArea();
|
||||
seriesMaxInvocationTime.name(JobChartMeasure.MaxInvocationTime.getLabel());
|
||||
seriesMaxInvocationTime.name(JobChartMeasure.MaxInvocationTime
|
||||
.getLabel());
|
||||
seriesMaxInvocationTime.color(colors.get(2));
|
||||
seriesMaxInvocationTime.yAxisAsString(JobChartMeasure.MaxInvocationTime.name());
|
||||
seriesMaxInvocationTime
|
||||
.yAxisAsString(JobChartMeasure.MaxInvocationTime.name());
|
||||
|
||||
ArrayNumber dataMaxInvocationTime = seriesMaxInvocationTime
|
||||
.dataAsArrayNumber();
|
||||
|
@ -415,9 +469,11 @@ public class JobChartBasicPanel extends SimpleContainer {
|
|||
|
||||
SeriesArea seriesMinInvocationTime = highchartsFactory
|
||||
.createSeriesArea();
|
||||
seriesMinInvocationTime.name(JobChartMeasure.MinInvocationTime.getLabel());
|
||||
seriesMinInvocationTime.name(JobChartMeasure.MinInvocationTime
|
||||
.getLabel());
|
||||
seriesMinInvocationTime.color(colors.get(3));
|
||||
seriesMinInvocationTime.yAxisAsString(JobChartMeasure.MinInvocationTime.name());
|
||||
seriesMinInvocationTime
|
||||
.yAxisAsString(JobChartMeasure.MinInvocationTime.name());
|
||||
|
||||
ArrayNumber dataMinInvocationTime = seriesMinInvocationTime
|
||||
.dataAsArrayNumber();
|
||||
|
@ -425,19 +481,14 @@ public class JobChartBasicPanel extends SimpleContainer {
|
|||
seriesMinInvocationTime.pointInterval(interval).pointStart(
|
||||
dateStart.getTime());
|
||||
|
||||
for (SeriesJobData seriesServiceData : seriesJobBasic.getSeries()) {
|
||||
dataOperationCount.push(seriesServiceData.getOperationCount());
|
||||
dataDuration.push(seriesServiceData.getOperationCount());
|
||||
dataMaxInvocationTime
|
||||
.push(seriesServiceData.getOperationCount());
|
||||
dataMinInvocationTime
|
||||
.push(seriesServiceData.getOperationCount());
|
||||
|
||||
//dataDuration.push(seriesServiceData.getDuration());
|
||||
//dataMaxInvocationTime
|
||||
// .push(seriesServiceData.getMaxInvocationTime());
|
||||
//dataMinInvocationTime
|
||||
// .push(seriesServiceData.getMinInvocationTime());
|
||||
for (SeriesJobData seriesJobData : seriesJobBasic
|
||||
.getSeries()) {
|
||||
dataOperationCount.push(seriesJobData.getOperationCount());
|
||||
dataDuration.push(seriesJobData.getDuration() / unitMeasure);
|
||||
dataMaxInvocationTime.push(seriesJobData.getMaxInvocationTime()
|
||||
/ unitMeasure);
|
||||
dataMinInvocationTime.push(seriesJobData.getMinInvocationTime()
|
||||
/ unitMeasure);
|
||||
}
|
||||
|
||||
options.series().addToEnd(seriesOperationCount);
|
||||
|
@ -448,29 +499,20 @@ public class JobChartBasicPanel extends SimpleContainer {
|
|||
options.chart().showAxes(true);
|
||||
|
||||
options.legend().enabled(true);
|
||||
// options.legend().layout("vertical");
|
||||
// options.legend().align("left");
|
||||
// options.legend().x(120);
|
||||
// options.legend().verticalAlign("top");
|
||||
// options.legend().y(100);
|
||||
// options.legend().floating(true);
|
||||
// options.legend()
|
||||
// .backgroundColor(
|
||||
// "(Highcharts.theme && Highcharts.theme.legendBackgroundColor) || 'white'");
|
||||
return;
|
||||
}
|
||||
|
||||
private void createSingleAxisChart() {
|
||||
SeriesJob seriesJob = (SeriesJob) accountingStateData
|
||||
.getSeriesResponse();
|
||||
|
||||
if(!(seriesJob.getSeriesJobDefinition() instanceof SeriesJobBasic)){
|
||||
Log.error("Invalid SeriesJobBasic!");
|
||||
|
||||
if (!(seriesJob.getSeriesJobDefinition() instanceof SeriesJobBasic)) {
|
||||
Log.debug("Invalid SeriesJobBasic!");
|
||||
return;
|
||||
}
|
||||
SeriesJobBasic seriesJobBasic=(SeriesJobBasic)seriesJob.getSeriesJobDefinition();
|
||||
SeriesJobBasic seriesJobBasic = (SeriesJobBasic) seriesJob
|
||||
.getSeriesJobDefinition();
|
||||
|
||||
|
||||
double minRange = ChartTimeMeasure
|
||||
.calculateMinRange(accountingStateData.getSeriesRequest()
|
||||
.getAccountingPeriod());
|
||||
|
@ -478,10 +520,10 @@ public class JobChartBasicPanel extends SimpleContainer {
|
|||
double interval = ChartTimeMeasure
|
||||
.calculateInterval(accountingStateData.getSeriesRequest()
|
||||
.getAccountingPeriod());
|
||||
|
||||
Date dateStart=dtf.parse(accountingStateData.getSeriesRequest()
|
||||
|
||||
Date dateStart = dtf.parse(accountingStateData.getSeriesRequest()
|
||||
.getAccountingPeriod().getStartDate());
|
||||
|
||||
|
||||
dateStart.setTime(dateStart.getTime()
|
||||
+ ChartTimeMeasure.timeZoneOffset() * ChartTimeMeasure.MINUTE);
|
||||
|
||||
|
@ -491,12 +533,12 @@ public class JobChartBasicPanel extends SimpleContainer {
|
|||
|
||||
HighchartsOptionFactory highchartsFactory = new JsoHighchartsOptionFactory();
|
||||
options = highchartsFactory.createChartOptions();
|
||||
|
||||
|
||||
options.navigation().buttonOptions().enabled(false);
|
||||
options.exporting().filename("AccountingService");
|
||||
options.exporting().filename("AccountingJob");
|
||||
options.chart().zoomType("xy");
|
||||
|
||||
options.title().text("Accounting Service");
|
||||
options.title().text("Accounting Job");
|
||||
|
||||
/*
|
||||
* options.subtitle().text("Click and drag in the plot area to zoom in");
|
||||
|
@ -513,41 +555,25 @@ public class JobChartBasicPanel extends SimpleContainer {
|
|||
// options.yAxis().title().text("Exchange rate");
|
||||
// Highcharts.getOptions().colors[0]
|
||||
|
||||
String multiAxis = "[{" + " \"id\": \""+JobChartMeasure.OperationCount.name()+"\","
|
||||
String multiAxis = "[{" + " \"id\": \""
|
||||
+ JobChartMeasure.OperationCount.name() + "\","
|
||||
+ " \"labels\": { " + " \"format\": \"{value}\","
|
||||
+ " \"style\": { " + " \"color\": \""
|
||||
+ colors.get(1)
|
||||
+ "\""
|
||||
+ " }"
|
||||
+ " },"
|
||||
+ " \"title\": { "
|
||||
+ " \"text\": \""+JobChartMeasure.OperationCount.getLabel()+"\","
|
||||
+ " \"style\": {"
|
||||
+ " \"color\": \""
|
||||
+ colors.get(1)
|
||||
+ "\""
|
||||
+ " }"
|
||||
+ " }"
|
||||
+ "} , {"
|
||||
+ " \"id\": \"ServiceData\", "
|
||||
+ " \"linkedTo\": \"0\","
|
||||
+ " \"gridLineWidth\": \"0\","
|
||||
+ " \"title\": {"
|
||||
+ " \"text\": \"\","
|
||||
+ " \"style\": {"
|
||||
+ " \"color\": \""
|
||||
+ colors.get(1)
|
||||
+ "\""
|
||||
+ " }"
|
||||
+ " },"
|
||||
+ " \"labels\": {"
|
||||
+ " \"format\": \"{value} ms\","
|
||||
+ " \"style\": {"
|
||||
+ " \"color\": \""
|
||||
+ colors.get(1)
|
||||
+ "\"" + " }" + " }," + " \"opposite\": \"true\"" + // +
|
||||
// ", \"showFirstLabel\": \"false\""
|
||||
// +
|
||||
+ " \"style\": { " + " \"color\": \"" + colors.get(1)
|
||||
+ "\"" + " }" + " }," + " \"title\": { "
|
||||
+ " \"text\": \""
|
||||
+ JobChartMeasure.OperationCount.getLabel() + "\","
|
||||
+ " \"style\": {" + " \"color\": \"" + colors.get(1)
|
||||
+ "\"" + " }" + " }" + "} , {"
|
||||
+ " \"id\": \"JobData\", " + " \"linkedTo\": \"0\","
|
||||
+ " \"gridLineWidth\": \"0\"," + " \"title\": {"
|
||||
+ " \"text\": \"\"," + " \"style\": {"
|
||||
+ " \"color\": \"" + colors.get(1) + "\"" + " }"
|
||||
+ " }," + " \"labels\": {" + " \"format\": \"{value} "
|
||||
+ unitMeasureLabel + "\"," + " \"style\": {"
|
||||
+ " \"color\": \"" + colors.get(1) + "\"" + " }"
|
||||
+ " }," + " \"opposite\": \"true\"" + // +
|
||||
// ", \"showFirstLabel\": \"false\""
|
||||
// +
|
||||
"}]";
|
||||
|
||||
options.setFieldAsJsonObject("yAxis", multiAxis);
|
||||
|
@ -564,7 +590,8 @@ public class JobChartBasicPanel extends SimpleContainer {
|
|||
|
||||
SeriesColumn seriesOperationCount = highchartsFactory
|
||||
.createSeriesColumn();
|
||||
seriesOperationCount.name(JobChartMeasure.OperationCount.getLabel());
|
||||
seriesOperationCount
|
||||
.name(JobChartMeasure.OperationCount.getLabel());
|
||||
seriesOperationCount.color(colors.get(1));
|
||||
seriesOperationCount.type("column");
|
||||
|
||||
|
@ -577,6 +604,7 @@ public class JobChartBasicPanel extends SimpleContainer {
|
|||
SeriesArea seriesDuration = highchartsFactory.createSeriesArea();
|
||||
seriesDuration.name(JobChartMeasure.Duration.getLabel());
|
||||
seriesDuration.color(colors.get(0));
|
||||
//seriesDuration.yAxisAsString("JobData");
|
||||
|
||||
ArrayNumber dataDuration = seriesDuration.dataAsArrayNumber();
|
||||
|
||||
|
@ -584,8 +612,10 @@ public class JobChartBasicPanel extends SimpleContainer {
|
|||
|
||||
SeriesArea seriesMaxInvocationTime = highchartsFactory
|
||||
.createSeriesArea();
|
||||
seriesMaxInvocationTime.name(JobChartMeasure.MaxInvocationTime.getLabel());
|
||||
seriesMaxInvocationTime.name(JobChartMeasure.MaxInvocationTime
|
||||
.getLabel());
|
||||
seriesMaxInvocationTime.color(colors.get(2));
|
||||
//seriesMaxInvocationTime.yAxisAsString("JobData");
|
||||
|
||||
ArrayNumber dataMaxInvocationTime = seriesMaxInvocationTime
|
||||
.dataAsArrayNumber();
|
||||
|
@ -595,9 +625,10 @@ public class JobChartBasicPanel extends SimpleContainer {
|
|||
|
||||
SeriesArea seriesMinInvocationTime = highchartsFactory
|
||||
.createSeriesArea();
|
||||
seriesMinInvocationTime.name(JobChartMeasure.MinInvocationTime.getLabel());
|
||||
seriesMinInvocationTime.name(JobChartMeasure.MinInvocationTime
|
||||
.getLabel());
|
||||
seriesMinInvocationTime.color(colors.get(3));
|
||||
// seriesMinInvocationTime.yAxisAsString("MinInvocationTime");
|
||||
//seriesMinInvocationTime.yAxisAsString("JobData");
|
||||
|
||||
ArrayNumber dataMinInvocationTime = seriesMinInvocationTime
|
||||
.dataAsArrayNumber();
|
||||
|
@ -605,20 +636,14 @@ public class JobChartBasicPanel extends SimpleContainer {
|
|||
seriesMinInvocationTime.pointInterval(interval).pointStart(
|
||||
dateStart.getTime());
|
||||
|
||||
for (SeriesJobData seriesJobData : seriesJobBasic.getSeries()) {
|
||||
//TODO fix data
|
||||
for (SeriesJobData seriesJobData : seriesJobBasic
|
||||
.getSeries()) {
|
||||
dataOperationCount.push(seriesJobData.getOperationCount());
|
||||
dataDuration.push(seriesJobData.getOperationCount());
|
||||
dataMaxInvocationTime
|
||||
.push(seriesJobData.getOperationCount());
|
||||
dataMinInvocationTime
|
||||
.push(seriesJobData.getOperationCount());
|
||||
|
||||
//dataDuration.push(seriesServiceData.getDuration());
|
||||
//dataMaxInvocationTime
|
||||
// .push(seriesServiceData.getMaxInvocationTime());
|
||||
//dataMinInvocationTime
|
||||
// .push(seriesServiceData.getMinInvocationTime());
|
||||
dataDuration.push(seriesJobData.getDuration() / unitMeasure);
|
||||
dataMaxInvocationTime.push(seriesJobData.getMaxInvocationTime()
|
||||
/ unitMeasure);
|
||||
dataMinInvocationTime.push(seriesJobData.getMinInvocationTime()
|
||||
/ unitMeasure);
|
||||
}
|
||||
|
||||
options.series().addToEnd(seriesOperationCount);
|
||||
|
|
|
@ -97,7 +97,7 @@ public class ServiceChartBasicPanel extends SimpleContainer {
|
|||
downloadButton.setMenu(createDownloadMenu());
|
||||
|
||||
unitButton = new TextButton(TIME_UNIT,
|
||||
AccountingManagerResources.INSTANCE.accountingUnitkB24());
|
||||
AccountingManagerResources.INSTANCE.accountingUnitms24());
|
||||
unitButton.setIconAlign(IconAlign.RIGHT);
|
||||
unitButton.setArrowAlign(ButtonArrowAlign.RIGHT);
|
||||
unitButton.setMenu(createUnitMenu());
|
||||
|
@ -146,33 +146,21 @@ public class ServiceChartBasicPanel extends SimpleContainer {
|
|||
highchartsLayoutPanel.renderChart(options);
|
||||
}
|
||||
forceLayout();
|
||||
|
||||
/*
|
||||
* vert.remove(highchartsLayoutPanel); // createMultiAxisChart();
|
||||
*
|
||||
* highchartsLayoutPanel = new HighchartsLayoutPanel();
|
||||
* highchartsLayoutPanel.renderChart(options);
|
||||
*
|
||||
* vert.add(highchartsLayoutPanel, new VerticalLayoutData(1, 1, new
|
||||
* Margins(0)));
|
||||
*
|
||||
* forceLayout();
|
||||
*/
|
||||
}
|
||||
|
||||
private Menu createUnitMenu() {
|
||||
Menu menuUnit = new Menu();
|
||||
msItem = new MenuItem(TimeUnitMeasure.MILLISECONDS,
|
||||
AccountingManagerResources.INSTANCE.accountingUnitkB24());
|
||||
AccountingManagerResources.INSTANCE.accountingUnitms24());
|
||||
msItem.setHeight(30);
|
||||
sItem = new MenuItem(TimeUnitMeasure.SECONDS,
|
||||
AccountingManagerResources.INSTANCE.accountingUnitMB24());
|
||||
AccountingManagerResources.INSTANCE.accountingUnits24());
|
||||
sItem.setHeight(30);
|
||||
mItem = new MenuItem(TimeUnitMeasure.MINUTES,
|
||||
AccountingManagerResources.INSTANCE.accountingUnitGB24());
|
||||
AccountingManagerResources.INSTANCE.accountingUnitm24());
|
||||
mItem.setHeight(30);
|
||||
hItem = new MenuItem(TimeUnitMeasure.HOURS,
|
||||
AccountingManagerResources.INSTANCE.accountingUnitTB24());
|
||||
AccountingManagerResources.INSTANCE.accountingUnith24());
|
||||
hItem.setHeight(30);
|
||||
|
||||
msItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
|
@ -182,7 +170,7 @@ public class ServiceChartBasicPanel extends SimpleContainer {
|
|||
unitMeasure = TimeUnitMeasure.getMilliseconds();
|
||||
unitMeasureLabel = TimeUnitMeasure.MS;
|
||||
unitButton.setIcon(AccountingManagerResources.INSTANCE
|
||||
.accountingUnitkB24());
|
||||
.accountingUnitms24());
|
||||
updateChart();
|
||||
}
|
||||
});
|
||||
|
@ -194,7 +182,7 @@ public class ServiceChartBasicPanel extends SimpleContainer {
|
|||
unitMeasure = TimeUnitMeasure.getSeconds();
|
||||
unitMeasureLabel = TimeUnitMeasure.S;
|
||||
unitButton.setIcon(AccountingManagerResources.INSTANCE
|
||||
.accountingUnitMB24());
|
||||
.accountingUnits24());
|
||||
updateChart();
|
||||
}
|
||||
});
|
||||
|
@ -206,7 +194,7 @@ public class ServiceChartBasicPanel extends SimpleContainer {
|
|||
unitMeasure = TimeUnitMeasure.getMinutes();
|
||||
unitMeasureLabel = TimeUnitMeasure.M;
|
||||
unitButton.setIcon(AccountingManagerResources.INSTANCE
|
||||
.accountingUnitGB24());
|
||||
.accountingUnitm24());
|
||||
updateChart();
|
||||
}
|
||||
});
|
||||
|
@ -218,7 +206,7 @@ public class ServiceChartBasicPanel extends SimpleContainer {
|
|||
unitMeasure = TimeUnitMeasure.getHours();
|
||||
unitMeasureLabel = TimeUnitMeasure.H;
|
||||
unitButton.setIcon(AccountingManagerResources.INSTANCE
|
||||
.accountingUnitTB24());
|
||||
.accountingUnith24());
|
||||
updateChart();
|
||||
}
|
||||
});
|
||||
|
@ -616,6 +604,7 @@ public class ServiceChartBasicPanel extends SimpleContainer {
|
|||
SeriesArea seriesDuration = highchartsFactory.createSeriesArea();
|
||||
seriesDuration.name(ServiceChartMeasure.Duration.getLabel());
|
||||
seriesDuration.color(colors.get(0));
|
||||
//seriesDuration.yAxisAsString("ServiceData");
|
||||
|
||||
ArrayNumber dataDuration = seriesDuration.dataAsArrayNumber();
|
||||
|
||||
|
@ -626,6 +615,7 @@ public class ServiceChartBasicPanel extends SimpleContainer {
|
|||
seriesMaxInvocationTime.name(ServiceChartMeasure.MaxInvocationTime
|
||||
.getLabel());
|
||||
seriesMaxInvocationTime.color(colors.get(2));
|
||||
//seriesMaxInvocationTime.yAxisAsString("ServiceData");
|
||||
|
||||
ArrayNumber dataMaxInvocationTime = seriesMaxInvocationTime
|
||||
.dataAsArrayNumber();
|
||||
|
@ -638,7 +628,7 @@ public class ServiceChartBasicPanel extends SimpleContainer {
|
|||
seriesMinInvocationTime.name(ServiceChartMeasure.MinInvocationTime
|
||||
.getLabel());
|
||||
seriesMinInvocationTime.color(colors.get(3));
|
||||
// seriesMinInvocationTime.yAxisAsString("MinInvocationTime");
|
||||
//seriesMinInvocationTime.yAxisAsString("ServiceData");
|
||||
|
||||
ArrayNumber dataMinInvocationTime = seriesMinInvocationTime
|
||||
.dataAsArrayNumber();
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.client.maindata.charts.service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
|
||||
import org.gcube.portlets.admin.accountingmanager.client.maindata.charts.utils.TimeUnitMeasure;
|
||||
import org.gcube.portlets.admin.accountingmanager.client.maindata.charts.utils.ChartTimeMeasure;
|
||||
import org.gcube.portlets.admin.accountingmanager.client.maindata.charts.utils.DownloadConstants;
|
||||
import org.gcube.portlets.admin.accountingmanager.client.maindata.charts.utils.ServiceChartMeasure;
|
||||
|
@ -18,7 +20,6 @@ import com.github.highcharts4gwt.model.array.api.ArrayString;
|
|||
import com.github.highcharts4gwt.model.factory.api.HighchartsOptionFactory;
|
||||
import com.github.highcharts4gwt.model.factory.jso.JsoHighchartsOptionFactory;
|
||||
import com.github.highcharts4gwt.model.highcharts.option.api.ChartOptions;
|
||||
import com.github.highcharts4gwt.model.highcharts.option.api.SeriesArea;
|
||||
import com.github.highcharts4gwt.model.highcharts.option.api.SeriesColumn;
|
||||
import com.google.gwt.event.logical.shared.SelectionEvent;
|
||||
import com.google.gwt.event.logical.shared.SelectionHandler;
|
||||
|
@ -28,14 +29,11 @@ import com.sencha.gxt.cell.core.client.ButtonCell.ButtonArrowAlign;
|
|||
import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign;
|
||||
import com.sencha.gxt.core.client.util.Margins;
|
||||
import com.sencha.gxt.widget.core.client.button.TextButton;
|
||||
import com.sencha.gxt.widget.core.client.button.ToggleButton;
|
||||
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData;
|
||||
import com.sencha.gxt.widget.core.client.container.MarginData;
|
||||
import com.sencha.gxt.widget.core.client.container.SimpleContainer;
|
||||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
||||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
|
||||
import com.sencha.gxt.widget.core.client.event.SelectEvent;
|
||||
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
||||
import com.sencha.gxt.widget.core.client.menu.Item;
|
||||
import com.sencha.gxt.widget.core.client.menu.Menu;
|
||||
import com.sencha.gxt.widget.core.client.menu.MenuItem;
|
||||
|
@ -48,12 +46,13 @@ import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
|
|||
*
|
||||
*/
|
||||
public class ServiceChartTopPanel extends SimpleContainer {
|
||||
private static final String TIME_UNIT = "Time Unit";
|
||||
|
||||
private static final String SINGLE_AXIS = "Single Axis";
|
||||
private static final String TIME_UNIT = "Time Unit";
|
||||
// private static final String MEASURE_TYPE = "Measure";
|
||||
|
||||
private DateTimeFormat dtf = DateTimeFormat
|
||||
.getFormat(PredefinedFormat.YEAR_MONTH_DAY);
|
||||
|
||||
private AccountingStateData accountingStateData;
|
||||
private HighchartsLayoutPanel highchartsLayoutPanel;
|
||||
|
||||
|
@ -63,14 +62,29 @@ public class ServiceChartTopPanel extends SimpleContainer {
|
|||
private MenuItem downloadPDFItem;
|
||||
private MenuItem downloadSVGItem;
|
||||
|
||||
// Measure Menu
|
||||
private MenuItem operationCountItem;
|
||||
private MenuItem durationItem;
|
||||
private MenuItem maxInvocationTimeItem;
|
||||
private MenuItem minInvocationTimeItem;
|
||||
|
||||
// Time Unit Menu
|
||||
private MenuItem msItem;
|
||||
private MenuItem sItem;
|
||||
private MenuItem mItem;
|
||||
private MenuItem hItem;
|
||||
|
||||
private long unitMeasure = TimeUnitMeasure.getMilliseconds();
|
||||
private String unitMeasureLabel = TimeUnitMeasure.MS;
|
||||
private TextButton unitButton;
|
||||
|
||||
private ChartOptions options;
|
||||
|
||||
private ServiceChartMeasure measure = ServiceChartMeasure.Duration;
|
||||
private TextButton measureButton;
|
||||
|
||||
private VerticalLayoutContainer vert;
|
||||
|
||||
public ServiceChartTopPanel(AccountingStateData accountingStateData) {
|
||||
this.accountingStateData = accountingStateData;
|
||||
forceLayoutOnResize = true;
|
||||
|
@ -90,40 +104,32 @@ public class ServiceChartTopPanel extends SimpleContainer {
|
|||
downloadButton.setArrowAlign(ButtonArrowAlign.RIGHT);
|
||||
downloadButton.setMenu(createDownloadMenu());
|
||||
|
||||
// Measure
|
||||
measureButton = new TextButton(ServiceChartMeasure.Duration.getLabel(),
|
||||
AccountingManagerResources.INSTANCE.accountingByte24());
|
||||
measureButton.setIconAlign(IconAlign.RIGHT);
|
||||
measureButton.setArrowAlign(ButtonArrowAlign.RIGHT);
|
||||
measureButton.setMenu(createMeasureMenu());
|
||||
|
||||
// Unit
|
||||
unitButton = new TextButton(TIME_UNIT,
|
||||
AccountingManagerResources.INSTANCE.accountingUnitms24());
|
||||
unitButton.setIconAlign(IconAlign.RIGHT);
|
||||
unitButton.setArrowAlign(ButtonArrowAlign.RIGHT);
|
||||
unitButton.setMenu(createUnitMenu());
|
||||
|
||||
toolBar.add(downloadButton, new BoxLayoutData(new Margins(0)));
|
||||
|
||||
// Single Axis
|
||||
final ToggleButton toggleButton = new ToggleButton(SINGLE_AXIS);
|
||||
toggleButton.setIcon(AccountingManagerResources.INSTANCE
|
||||
.accountingChartVariableAxis24());
|
||||
toggleButton.setIconAlign(IconAlign.RIGHT);
|
||||
toggleButton.setValue(false);
|
||||
|
||||
toggleButton.addSelectHandler(new SelectHandler() {
|
||||
|
||||
@Override
|
||||
public void onSelect(SelectEvent event) {
|
||||
if (toggleButton.getValue()) {
|
||||
createSingleAxisChart();
|
||||
highchartsLayoutPanel.renderChart(options);
|
||||
} else {
|
||||
createMultiAxisChart();
|
||||
highchartsLayoutPanel.renderChart(options);
|
||||
}
|
||||
forceLayout();
|
||||
}
|
||||
});
|
||||
|
||||
toolBar.add(toggleButton, new BoxLayoutData(new Margins(0)));
|
||||
toolBar.add(measureButton, new BoxLayoutData(new Margins(0)));
|
||||
toolBar.add(unitButton, new BoxLayoutData(new Margins(0)));
|
||||
|
||||
//
|
||||
createMultiAxisChart();
|
||||
createChart();
|
||||
|
||||
highchartsLayoutPanel = new HighchartsLayoutPanel();
|
||||
highchartsLayoutPanel.renderChart(options);
|
||||
|
||||
//
|
||||
VerticalLayoutContainer vert = new VerticalLayoutContainer();
|
||||
vert = new VerticalLayoutContainer();
|
||||
vert.add(toolBar, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
vert.add(highchartsLayoutPanel, new VerticalLayoutData(1, 1,
|
||||
new Margins(0)));
|
||||
|
@ -132,8 +138,13 @@ public class ServiceChartTopPanel extends SimpleContainer {
|
|||
|
||||
}
|
||||
|
||||
private Menu createDownloadMenu() {
|
||||
private void updateChart() {
|
||||
createChart();
|
||||
highchartsLayoutPanel.renderChart(options);
|
||||
forceLayout();
|
||||
}
|
||||
|
||||
private Menu createDownloadMenu() {
|
||||
Menu menuDownload = new Menu();
|
||||
downloadPNGItem = new MenuItem(DownloadConstants.DOWNLOAD_PNG,
|
||||
AccountingManagerResources.INSTANCE.accountingFilePNG24());
|
||||
|
@ -193,6 +204,148 @@ public class ServiceChartTopPanel extends SimpleContainer {
|
|||
|
||||
}
|
||||
|
||||
private Menu createMeasureMenu() {
|
||||
Menu menuMeasure = new Menu();
|
||||
// TODO
|
||||
durationItem = new MenuItem(ServiceChartMeasure.Duration.getLabel());
|
||||
durationItem.setHeight(30);
|
||||
operationCountItem = new MenuItem(
|
||||
ServiceChartMeasure.OperationCount.getLabel());
|
||||
operationCountItem.setHeight(30);
|
||||
maxInvocationTimeItem = new MenuItem(
|
||||
ServiceChartMeasure.MaxInvocationTime.getLabel());
|
||||
maxInvocationTimeItem.setHeight(30);
|
||||
minInvocationTimeItem = new MenuItem(
|
||||
ServiceChartMeasure.MinInvocationTime.getLabel());
|
||||
minInvocationTimeItem.setHeight(30);
|
||||
|
||||
durationItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
|
||||
@Override
|
||||
public void onSelection(SelectionEvent<Item> event) {
|
||||
measureButton.setText(ServiceChartMeasure.Duration.getLabel());
|
||||
measure = ServiceChartMeasure.Duration;
|
||||
unitButton.setVisible(true);
|
||||
updateChart();
|
||||
}
|
||||
});
|
||||
|
||||
operationCountItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
|
||||
@Override
|
||||
public void onSelection(SelectionEvent<Item> event) {
|
||||
measureButton.setText(ServiceChartMeasure.OperationCount
|
||||
.getLabel());
|
||||
measure = ServiceChartMeasure.OperationCount;
|
||||
unitButton.setVisible(false);
|
||||
updateChart();
|
||||
}
|
||||
});
|
||||
|
||||
maxInvocationTimeItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
|
||||
@Override
|
||||
public void onSelection(SelectionEvent<Item> event) {
|
||||
measureButton.setText(ServiceChartMeasure.MaxInvocationTime
|
||||
.getLabel());
|
||||
measure = ServiceChartMeasure.MaxInvocationTime;
|
||||
unitButton.setVisible(true);
|
||||
updateChart();
|
||||
}
|
||||
});
|
||||
|
||||
minInvocationTimeItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
|
||||
@Override
|
||||
public void onSelection(SelectionEvent<Item> event) {
|
||||
measureButton.setText(ServiceChartMeasure.MinInvocationTime
|
||||
.getLabel());
|
||||
measure = ServiceChartMeasure.MinInvocationTime;
|
||||
unitButton.setVisible(true);
|
||||
updateChart();
|
||||
}
|
||||
});
|
||||
|
||||
menuMeasure.add(durationItem);
|
||||
menuMeasure.add(maxInvocationTimeItem);
|
||||
menuMeasure.add(minInvocationTimeItem);
|
||||
menuMeasure.add(operationCountItem);
|
||||
|
||||
return menuMeasure;
|
||||
|
||||
}
|
||||
|
||||
private Menu createUnitMenu() {
|
||||
Menu menuUnit = new Menu();
|
||||
msItem = new MenuItem(TimeUnitMeasure.MILLISECONDS,
|
||||
AccountingManagerResources.INSTANCE.accountingUnitms24());
|
||||
msItem.setHeight(30);
|
||||
sItem = new MenuItem(TimeUnitMeasure.SECONDS,
|
||||
AccountingManagerResources.INSTANCE.accountingUnits24());
|
||||
sItem.setHeight(30);
|
||||
mItem = new MenuItem(TimeUnitMeasure.MINUTES,
|
||||
AccountingManagerResources.INSTANCE.accountingUnitm24());
|
||||
mItem.setHeight(30);
|
||||
hItem = new MenuItem(TimeUnitMeasure.HOURS,
|
||||
AccountingManagerResources.INSTANCE.accountingUnith24());
|
||||
hItem.setHeight(30);
|
||||
|
||||
msItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
|
||||
@Override
|
||||
public void onSelection(SelectionEvent<Item> event) {
|
||||
unitMeasure = TimeUnitMeasure.getMilliseconds();
|
||||
unitMeasureLabel = TimeUnitMeasure.MS;
|
||||
unitButton.setIcon(AccountingManagerResources.INSTANCE
|
||||
.accountingUnitms24());
|
||||
updateChart();
|
||||
}
|
||||
});
|
||||
|
||||
sItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
|
||||
@Override
|
||||
public void onSelection(SelectionEvent<Item> event) {
|
||||
unitMeasure = TimeUnitMeasure.getSeconds();
|
||||
unitMeasureLabel = TimeUnitMeasure.S;
|
||||
unitButton.setIcon(AccountingManagerResources.INSTANCE
|
||||
.accountingUnits24());
|
||||
updateChart();
|
||||
}
|
||||
});
|
||||
|
||||
mItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
|
||||
@Override
|
||||
public void onSelection(SelectionEvent<Item> event) {
|
||||
unitMeasure = TimeUnitMeasure.getMinutes();
|
||||
unitMeasureLabel = TimeUnitMeasure.M;
|
||||
unitButton.setIcon(AccountingManagerResources.INSTANCE
|
||||
.accountingUnitm24());
|
||||
updateChart();
|
||||
}
|
||||
});
|
||||
|
||||
hItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
|
||||
@Override
|
||||
public void onSelection(SelectionEvent<Item> event) {
|
||||
unitMeasure = TimeUnitMeasure.getHours();
|
||||
unitMeasureLabel = TimeUnitMeasure.H;
|
||||
unitButton.setIcon(AccountingManagerResources.INSTANCE
|
||||
.accountingUnith24());
|
||||
updateChart();
|
||||
}
|
||||
});
|
||||
|
||||
menuUnit.add(msItem);
|
||||
menuUnit.add(sItem);
|
||||
menuUnit.add(mItem);
|
||||
menuUnit.add(hItem);
|
||||
return menuUnit;
|
||||
|
||||
}
|
||||
|
||||
// chart.options.exporting.buttons.contextButton.menuItems[0].onclick();
|
||||
|
||||
public static native void onDownloadPNG(String id) /*-{
|
||||
|
@ -245,7 +398,7 @@ public class ServiceChartTopPanel extends SimpleContainer {
|
|||
|
||||
}-*/;
|
||||
|
||||
private void createMultiAxisChart() {
|
||||
private void createChart() {
|
||||
SeriesService seriesService = (SeriesService) accountingStateData
|
||||
.getSeriesResponse();
|
||||
|
||||
|
@ -275,13 +428,12 @@ public class ServiceChartTopPanel extends SimpleContainer {
|
|||
.format(dateStart));
|
||||
|
||||
HighchartsOptionFactory highchartsFactory = new JsoHighchartsOptionFactory();
|
||||
|
||||
options = highchartsFactory.createChartOptions();
|
||||
|
||||
options.navigation().buttonOptions().enabled(false);
|
||||
options.exporting().filename("AccountingServiceTop");
|
||||
options.chart().zoomType("xy");
|
||||
|
||||
options.title().text("Accounting Service");
|
||||
options.exporting().buttons().contextButton().enabled(false);
|
||||
options.exporting().filename("AccountingServiceTop");
|
||||
options.title().text("Accounting Service Top");
|
||||
|
||||
/*
|
||||
* options.subtitle().text("Click and drag in the plot area to zoom in");
|
||||
|
@ -295,287 +447,140 @@ public class ServiceChartTopPanel extends SimpleContainer {
|
|||
options.xAxis().type("datetime").minRange(minRange);
|
||||
|
||||
// yAxis
|
||||
String multiAxis = "[{" + " \"id\": \""
|
||||
+ ServiceChartMeasure.OperationCount.name() + "\","
|
||||
+ " \"labels\": { " + " \"format\": \"{value}\","
|
||||
+ " \"style\": { " + " \"color\": \"" + colors.get(1)
|
||||
+ "\"" + " }" + " }," + " \"title\": { "
|
||||
+ " \"text\": \""
|
||||
+ ServiceChartMeasure.OperationCount.getLabel() + "\","
|
||||
+ " \"style\": {" + " \"color\": \"" + colors.get(1)
|
||||
+ "\"" + " }" + " }" + "} , {" + " \"id\": \""
|
||||
+ ServiceChartMeasure.Duration.name() + "\", "
|
||||
+ " \"title\": {" + " \"text\": \""
|
||||
+ ServiceChartMeasure.Duration.getLabel() + "\","
|
||||
+ " \"style\": {" + " \"color\": \"" + colors.get(0)
|
||||
+ "\"" + " }" + " }," + " \"labels\": {"
|
||||
+ " \"format\": \"{value} ms\"," + " \"style\": {"
|
||||
+ " \"color\": \"" + colors.get(0) + "\"" + " }"
|
||||
+ " }," + " \"opposite\": \"true\""
|
||||
+ ", \"showFirstLabel\": \"false\"" + "} , {" + " \"id\": \""
|
||||
+ ServiceChartMeasure.MaxInvocationTime.name() + "\", "
|
||||
+ " \"title\": {" + " \"text\": \""
|
||||
+ ServiceChartMeasure.MaxInvocationTime.getLabel() + "\","
|
||||
+ " \"style\": {" + " \"color\": \"" + colors.get(2)
|
||||
+ "\"" + " }" + " }," + " \"labels\": {"
|
||||
+ " \"format\": \"{value} ms\"," + " \"style\": {"
|
||||
+ " \"color\": \"" + colors.get(2) + "\"" + " }"
|
||||
+ " }," + " \"opposite\": \"true\""
|
||||
+ ", \"showFirstLabel\": \"false\"" + "} , {" + " \"id\": \""
|
||||
+ ServiceChartMeasure.MinInvocationTime.name() + "\", "
|
||||
+ " \"title\": {" + " \"text\": \""
|
||||
+ ServiceChartMeasure.MinInvocationTime.getLabel() + "\","
|
||||
+ " \"style\": {" + " \"color\": \"" + colors.get(3)
|
||||
+ "\"" + " }" + " }," + " \"labels\": {"
|
||||
+ " \"format\": \"{value} ms\"," + " \"style\": {"
|
||||
+ " \"color\": \"" + colors.get(3) + "\"" + " }"
|
||||
+ " }," + " \"opposite\": \"true\""
|
||||
+ ", \"showFirstLabel\": \"false\"" + "}]"
|
||||
options.setFieldAsJsonObject("yAxis", retrieveYAxis(colors));
|
||||
|
||||
;
|
||||
options.plotOptions().setFieldAsJsonObject(
|
||||
"column",
|
||||
"{ " + "\"stacking\": \"normal\"," + "\"dataLabels\": { "
|
||||
+ " \"enabled\": \"true\","
|
||||
+ " \"color\": \"white\", " + " \"style\": {"
|
||||
+ " \"textShadow\": \"0 0 3px black\"" + " }"
|
||||
+ " }" + " }");
|
||||
|
||||
options.setFieldAsJsonObject("yAxis", multiAxis);
|
||||
ArrayList<SeriesColumn> seriesColumn = new ArrayList<>();
|
||||
for (int i = 0; i < seriesServiceTop.getSeriesServiceDataTopList()
|
||||
.size(); i++) {
|
||||
SeriesColumn seriesColumnData = highchartsFactory
|
||||
.createSeriesColumn();
|
||||
|
||||
// does not seem to be working
|
||||
String fillcolor = "{" + "\"linearGradient\": {" + "\"x1\": 0,"
|
||||
+ "\"y1\": 0," + "\"x2\": 0," + "\"y2\": 1" + "},"
|
||||
+ "\"stops\": [" + "[" + "0, \"#058DC7\"" + "]," + "["
|
||||
+ "1, \"#FFFFFF\"" + "]" + "]" + "}";
|
||||
seriesColumnData.name(seriesServiceTop
|
||||
.getSeriesServiceDataTopList().get(i).getFilterValue()
|
||||
.getValue());
|
||||
seriesColumnData.color(colors.get(i));
|
||||
seriesColumnData.type("column");
|
||||
|
||||
options.plotOptions().area()
|
||||
.setFieldAsJsonObject("fillColor", fillcolor).marker()
|
||||
.radius(2).lineWidth(1).states().hover().lineWidth(1);
|
||||
ArrayNumber data = seriesColumnData.dataAsArrayNumber();
|
||||
|
||||
SeriesColumn seriesOperationCount = highchartsFactory
|
||||
.createSeriesColumn();
|
||||
seriesOperationCount
|
||||
.name(ServiceChartMeasure.OperationCount.getLabel());
|
||||
seriesOperationCount.color(colors.get(1));
|
||||
seriesOperationCount.type("column");
|
||||
for (SeriesServiceData seriesServiceData : seriesServiceTop
|
||||
.getSeriesServiceDataTopList().get(i).getSeries()) {
|
||||
switch (measure) {
|
||||
case Duration:
|
||||
data.push(seriesServiceData.getDuration() / unitMeasure);
|
||||
break;
|
||||
case MaxInvocationTime:
|
||||
data.push(seriesServiceData.getMaxInvocationTime()
|
||||
/ unitMeasure);
|
||||
break;
|
||||
case MinInvocationTime:
|
||||
data.push(seriesServiceData.getMinInvocationTime()
|
||||
/ unitMeasure);
|
||||
break;
|
||||
case OperationCount:
|
||||
data.push(seriesServiceData.getOperationCount());
|
||||
break;
|
||||
default:
|
||||
data.push(seriesServiceData.getDuration() / unitMeasure);
|
||||
break;
|
||||
|
||||
ArrayNumber dataOperationCount = seriesOperationCount
|
||||
.dataAsArrayNumber();
|
||||
}
|
||||
|
||||
seriesOperationCount.pointInterval(interval).pointStart(
|
||||
dateStart.getTime());
|
||||
}
|
||||
|
||||
SeriesArea seriesDuration = highchartsFactory.createSeriesArea();
|
||||
seriesDuration.name(ServiceChartMeasure.Duration.getLabel());
|
||||
seriesDuration.color(colors.get(0));
|
||||
seriesDuration.yAxisAsString(ServiceChartMeasure.Duration.name());
|
||||
seriesColumnData.pointInterval(interval).pointStart(
|
||||
dateStart.getTime());
|
||||
seriesColumn.add(seriesColumnData);
|
||||
|
||||
ArrayNumber dataDuration = seriesDuration.dataAsArrayNumber();
|
||||
|
||||
seriesDuration.pointInterval(interval).pointStart(dateStart.getTime());
|
||||
|
||||
SeriesArea seriesMaxInvocationTime = highchartsFactory
|
||||
.createSeriesArea();
|
||||
seriesMaxInvocationTime.name(ServiceChartMeasure.MaxInvocationTime
|
||||
.getLabel());
|
||||
seriesMaxInvocationTime.color(colors.get(2));
|
||||
seriesMaxInvocationTime
|
||||
.yAxisAsString(ServiceChartMeasure.MaxInvocationTime.name());
|
||||
|
||||
ArrayNumber dataMaxInvocationTime = seriesMaxInvocationTime
|
||||
.dataAsArrayNumber();
|
||||
|
||||
seriesMaxInvocationTime.pointInterval(interval).pointStart(
|
||||
dateStart.getTime());
|
||||
|
||||
SeriesArea seriesMinInvocationTime = highchartsFactory
|
||||
.createSeriesArea();
|
||||
seriesMinInvocationTime.name(ServiceChartMeasure.MinInvocationTime
|
||||
.getLabel());
|
||||
seriesMinInvocationTime.color(colors.get(3));
|
||||
seriesMinInvocationTime
|
||||
.yAxisAsString(ServiceChartMeasure.MinInvocationTime.name());
|
||||
|
||||
ArrayNumber dataMinInvocationTime = seriesMinInvocationTime
|
||||
.dataAsArrayNumber();
|
||||
|
||||
seriesMinInvocationTime.pointInterval(interval).pointStart(
|
||||
dateStart.getTime());
|
||||
|
||||
for (SeriesServiceData seriesServiceData : seriesServiceTop
|
||||
.getSeriesServiceDataTopList().get(0).getSeries()) {
|
||||
dataOperationCount.push(seriesServiceData.getOperationCount());
|
||||
dataDuration.push(seriesServiceData.getDuration());
|
||||
dataMaxInvocationTime
|
||||
.push(seriesServiceData.getMaxInvocationTime());
|
||||
dataMinInvocationTime
|
||||
.push(seriesServiceData.getMinInvocationTime());
|
||||
}
|
||||
|
||||
options.series().addToEnd(seriesOperationCount);
|
||||
options.series().addToEnd(seriesDuration);
|
||||
options.series().addToEnd(seriesMaxInvocationTime);
|
||||
options.series().addToEnd(seriesMinInvocationTime);
|
||||
for (SeriesColumn serie : seriesColumn) {
|
||||
options.series().addToEnd(serie);
|
||||
}
|
||||
|
||||
options.chart().showAxes(true);
|
||||
|
||||
options.legend().enabled(true);
|
||||
// options.legend().layout("vertical");
|
||||
// options.legend().align("left");
|
||||
// options.legend().x(120);
|
||||
// options.legend().verticalAlign("top");
|
||||
// options.legend().y(100);
|
||||
// options.legend().floating(true);
|
||||
// options.legend()
|
||||
// .backgroundColor(
|
||||
// "(Highcharts.theme && Highcharts.theme.legendBackgroundColor) || 'white'");
|
||||
return;
|
||||
}
|
||||
|
||||
private void createSingleAxisChart() {
|
||||
SeriesService seriesService = (SeriesService) accountingStateData
|
||||
.getSeriesResponse();
|
||||
private String retrieveYAxis(ArrayString colors) {
|
||||
switch (measure) {
|
||||
case Duration:
|
||||
return "[{" + " \"id\": \"" + ServiceChartMeasure.Duration.name()
|
||||
+ "\"," + " \"labels\": {" + " \"format\": \"{value} "
|
||||
+ unitMeasureLabel + "\"," + " \"style\": {"
|
||||
+ " \"color\": \"" + colors.get(1) + "\"" + " }"
|
||||
+ " }," + " \"stackLabels\": {" + " \"enabled\": \"true\","
|
||||
+ " \"style\": {" + " \"fontWeight\": \"bold\","
|
||||
+ " \"color\": \"gray\"" + " } " + " },"
|
||||
+ " \"title\": { " + " \"text\": \""
|
||||
+ ServiceChartMeasure.Duration.getLabel() + "\","
|
||||
+ " \"style\": {" + " \"color\": \""
|
||||
+ colors.get(1) + "\"" + " }" + " }" + "}]";
|
||||
case MaxInvocationTime:
|
||||
return "[{" + " \"id\": \""
|
||||
+ ServiceChartMeasure.MaxInvocationTime.name() + "\","
|
||||
+ " \"labels\": {" + " \"format\": \"{value} "
|
||||
+ unitMeasureLabel + "\"," + " \"style\": {"
|
||||
+ " \"color\": \"" + colors.get(1) + "\"" + " }"
|
||||
+ " }," + " \"stackLabels\": {" + " \"enabled\": \"true\","
|
||||
+ " \"style\": {" + " \"fontWeight\": \"bold\","
|
||||
+ " \"color\": \"gray\"" + " } " + " },"
|
||||
+ " \"title\": { " + " \"text\": \""
|
||||
+ ServiceChartMeasure.MaxInvocationTime.getLabel() + "\","
|
||||
+ " \"style\": {" + " \"color\": \""
|
||||
+ colors.get(1) + "\"" + " }" + " }" + "}]";
|
||||
case MinInvocationTime:
|
||||
return "[{" + " \"id\": \""
|
||||
+ ServiceChartMeasure.MinInvocationTime.name() + "\","
|
||||
+ " \"labels\": {" + " \"format\": \"{value} "
|
||||
+ unitMeasureLabel + "\"," + " \"style\": {"
|
||||
+ " \"color\": \"" + colors.get(1) + "\"" + " }"
|
||||
+ " }," + " \"stackLabels\": {" + " \"enabled\": \"true\","
|
||||
+ " \"style\": {" + " \"fontWeight\": \"bold\","
|
||||
+ " \"color\": \"gray\"" + " } " + " },"
|
||||
+ " \"title\": { " + " \"text\": \""
|
||||
+ ServiceChartMeasure.MinInvocationTime.getLabel() + "\","
|
||||
+ " \"style\": {" + " \"color\": \""
|
||||
+ colors.get(1) + "\"" + " }" + " }" + "}]";
|
||||
case OperationCount:
|
||||
return "[{" + " \"id\": \""
|
||||
+ ServiceChartMeasure.OperationCount.name() + "\","
|
||||
+ " \"labels\": { " + " \"format\": \"{value}\","
|
||||
+ " \"style\": { " + " \"color\": \""
|
||||
+ colors.get(1) + "\"" + " }" + " },"
|
||||
+ " \"stackLabels\": {" + " \"enabled\": \"true\","
|
||||
+ " \"style\": {" + " \"fontWeight\": \"bold\","
|
||||
+ " \"color\": \"gray\"" + " } " + " },"
|
||||
+ " \"title\": { " + " \"text\": \""
|
||||
+ ServiceChartMeasure.OperationCount.getLabel() + "\","
|
||||
+ " \"style\": {" + " \"color\": \""
|
||||
+ colors.get(1) + "\"" + " }" + " }" + "}]";
|
||||
|
||||
if (!(seriesService.getSerieServiceDefinition() instanceof SeriesServiceTop)) {
|
||||
Log.debug("Invalid SeriesServiceTop!");
|
||||
return;
|
||||
}
|
||||
SeriesServiceTop seriesServiceTop = (SeriesServiceTop) seriesService
|
||||
.getSerieServiceDefinition();
|
||||
default:
|
||||
return "[{" + " \"id\": \"" + ServiceChartMeasure.Duration.name()
|
||||
+ "\"," + " \"labels\": {" + " \"format\": \"{value} "
|
||||
+ unitMeasureLabel + "\"," + " \"style\": {"
|
||||
+ " \"color\": \"" + colors.get(1) + "\"" + " }"
|
||||
+ " }," + " \"stackLabels\": {" + " \"enabled\": \"true\","
|
||||
+ " \"style\": {" + " \"fontWeight\": \"bold\","
|
||||
+ " \"color\": \"gray\"" + " } " + " },"
|
||||
+ " \"title\": { " + " \"text\": \""
|
||||
+ ServiceChartMeasure.Duration.getLabel() + "\","
|
||||
+ " \"style\": {" + " \"color\": \""
|
||||
+ colors.get(1) + "\"" + " }" + " }" + "}]";
|
||||
|
||||
double minRange = ChartTimeMeasure
|
||||
.calculateMinRange(accountingStateData.getSeriesRequest()
|
||||
.getAccountingPeriod());
|
||||
|
||||
double interval = ChartTimeMeasure
|
||||
.calculateInterval(accountingStateData.getSeriesRequest()
|
||||
.getAccountingPeriod());
|
||||
|
||||
Date dateStart = dtf.parse(accountingStateData.getSeriesRequest()
|
||||
.getAccountingPeriod().getStartDate());
|
||||
|
||||
dateStart.setTime(dateStart.getTime()
|
||||
+ ChartTimeMeasure.timeZoneOffset() * ChartTimeMeasure.MINUTE);
|
||||
|
||||
Log.debug("BuildChart DateStart: "
|
||||
+ DateTimeFormat.getFormat(PredefinedFormat.DATE_TIME_FULL)
|
||||
.format(dateStart));
|
||||
|
||||
HighchartsOptionFactory highchartsFactory = new JsoHighchartsOptionFactory();
|
||||
options = highchartsFactory.createChartOptions();
|
||||
|
||||
options.navigation().buttonOptions().enabled(false);
|
||||
options.exporting().filename("AccountingService");
|
||||
options.chart().zoomType("xy");
|
||||
|
||||
options.title().text("Accounting Service");
|
||||
|
||||
/*
|
||||
* options.subtitle().text("Click and drag in the plot area to zoom in");
|
||||
*/
|
||||
|
||||
ArrayString colors = options.colors();
|
||||
// colors.setValue(0, "#cc0038");
|
||||
// colors.setValue(1, "#32cd32");
|
||||
|
||||
// xAxis
|
||||
options.xAxis().type("datetime").minRange(minRange);
|
||||
|
||||
// yAxis
|
||||
// options.yAxis().title().text("Exchange rate");
|
||||
// Highcharts.getOptions().colors[0]
|
||||
|
||||
String multiAxis = "[{" + " \"id\": \""
|
||||
+ ServiceChartMeasure.OperationCount.name() + "\","
|
||||
+ " \"labels\": { " + " \"format\": \"{value}\","
|
||||
+ " \"style\": { " + " \"color\": \"" + colors.get(1)
|
||||
+ "\"" + " }" + " }," + " \"title\": { "
|
||||
+ " \"text\": \""
|
||||
+ ServiceChartMeasure.OperationCount.getLabel() + "\","
|
||||
+ " \"style\": {" + " \"color\": \"" + colors.get(1)
|
||||
+ "\"" + " }" + " }" + "} , {"
|
||||
+ " \"id\": \"ServiceData\", " + " \"linkedTo\": \"0\","
|
||||
+ " \"gridLineWidth\": \"0\"," + " \"title\": {"
|
||||
+ " \"text\": \"\"," + " \"style\": {"
|
||||
+ " \"color\": \"" + colors.get(1) + "\"" + " }"
|
||||
+ " }," + " \"labels\": {" + " \"format\": \"{value} ms\","
|
||||
+ " \"style\": {" + " \"color\": \"" + colors.get(1)
|
||||
+ "\"" + " }" + " }," + " \"opposite\": \"true\"" + // +
|
||||
// ", \"showFirstLabel\": \"false\""
|
||||
// +
|
||||
"}]";
|
||||
|
||||
options.setFieldAsJsonObject("yAxis", multiAxis);
|
||||
|
||||
// does not seem to be working
|
||||
String fillcolor = "{" + "\"linearGradient\": {" + "\"x1\": 0,"
|
||||
+ "\"y1\": 0," + "\"x2\": 0," + "\"y2\": 1" + "},"
|
||||
+ "\"stops\": [" + "[" + "0, \"#058DC7\"" + "]," + "["
|
||||
+ "1, \"#FFFFFF\"" + "]" + "]" + "}";
|
||||
|
||||
options.plotOptions().area()
|
||||
.setFieldAsJsonObject("fillColor", fillcolor).marker()
|
||||
.radius(2).lineWidth(1).states().hover().lineWidth(1);
|
||||
|
||||
SeriesColumn seriesOperationCount = highchartsFactory
|
||||
.createSeriesColumn();
|
||||
seriesOperationCount
|
||||
.name(ServiceChartMeasure.OperationCount.getLabel());
|
||||
seriesOperationCount.color(colors.get(1));
|
||||
seriesOperationCount.type("column");
|
||||
|
||||
ArrayNumber dataOperationCount = seriesOperationCount
|
||||
.dataAsArrayNumber();
|
||||
|
||||
seriesOperationCount.pointInterval(interval).pointStart(
|
||||
dateStart.getTime());
|
||||
|
||||
SeriesArea seriesDuration = highchartsFactory.createSeriesArea();
|
||||
seriesDuration.name(ServiceChartMeasure.Duration.getLabel());
|
||||
seriesDuration.color(colors.get(0));
|
||||
|
||||
ArrayNumber dataDuration = seriesDuration.dataAsArrayNumber();
|
||||
|
||||
seriesDuration.pointInterval(interval).pointStart(dateStart.getTime());
|
||||
|
||||
SeriesArea seriesMaxInvocationTime = highchartsFactory
|
||||
.createSeriesArea();
|
||||
seriesMaxInvocationTime.name(ServiceChartMeasure.MaxInvocationTime
|
||||
.getLabel());
|
||||
seriesMaxInvocationTime.color(colors.get(2));
|
||||
|
||||
ArrayNumber dataMaxInvocationTime = seriesMaxInvocationTime
|
||||
.dataAsArrayNumber();
|
||||
|
||||
seriesMaxInvocationTime.pointInterval(interval).pointStart(
|
||||
dateStart.getTime());
|
||||
|
||||
SeriesArea seriesMinInvocationTime = highchartsFactory
|
||||
.createSeriesArea();
|
||||
seriesMinInvocationTime.name(ServiceChartMeasure.MinInvocationTime
|
||||
.getLabel());
|
||||
seriesMinInvocationTime.color(colors.get(3));
|
||||
// seriesMinInvocationTime.yAxisAsString("MinInvocationTime");
|
||||
|
||||
ArrayNumber dataMinInvocationTime = seriesMinInvocationTime
|
||||
.dataAsArrayNumber();
|
||||
|
||||
seriesMinInvocationTime.pointInterval(interval).pointStart(
|
||||
dateStart.getTime());
|
||||
|
||||
for (SeriesServiceData seriesServiceData : seriesServiceTop
|
||||
.getSeriesServiceDataTopList().get(0).getSeries()) {
|
||||
dataOperationCount.push(seriesServiceData.getOperationCount());
|
||||
dataDuration.push(seriesServiceData.getDuration());
|
||||
dataMaxInvocationTime
|
||||
.push(seriesServiceData.getMaxInvocationTime());
|
||||
dataMinInvocationTime
|
||||
.push(seriesServiceData.getMinInvocationTime());
|
||||
}
|
||||
|
||||
options.series().addToEnd(seriesOperationCount);
|
||||
options.series().addToEnd(seriesDuration);
|
||||
options.series().addToEnd(seriesMaxInvocationTime);
|
||||
options.series().addToEnd(seriesMinInvocationTime);
|
||||
|
||||
options.chart().showAxes(true);
|
||||
|
||||
options.legend().enabled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -119,17 +119,21 @@ public class StorageChartBasicPanel extends SimpleContainer {
|
|||
}
|
||||
|
||||
private void updateChart() {
|
||||
vert.remove(highchartsLayoutPanel);
|
||||
//
|
||||
createChart();
|
||||
|
||||
highchartsLayoutPanel = new HighchartsLayoutPanel();
|
||||
highchartsLayoutPanel.renderChart(options);
|
||||
|
||||
vert.add(highchartsLayoutPanel, new VerticalLayoutData(1, 1,
|
||||
new Margins(0)));
|
||||
|
||||
forceLayout();
|
||||
|
||||
/*
|
||||
* vert.remove(highchartsLayoutPanel); // createChart();
|
||||
*
|
||||
* highchartsLayoutPanel = new HighchartsLayoutPanel();
|
||||
* highchartsLayoutPanel.renderChart(options);
|
||||
*
|
||||
* vert.add(highchartsLayoutPanel, new VerticalLayoutData(1, 1, new
|
||||
* Margins(0)));
|
||||
*
|
||||
* forceLayout();
|
||||
*/
|
||||
}
|
||||
|
||||
private Menu createUnitMenu() {
|
||||
|
|
|
@ -138,6 +138,10 @@ public class StorageChartTopPanel extends SimpleContainer {
|
|||
}
|
||||
|
||||
private void updateChart() {
|
||||
createChart();
|
||||
highchartsLayoutPanel.renderChart(options);
|
||||
forceLayout();
|
||||
/*
|
||||
vert.remove(highchartsLayoutPanel);
|
||||
//
|
||||
createChart();
|
||||
|
@ -149,6 +153,7 @@ public class StorageChartTopPanel extends SimpleContainer {
|
|||
new Margins(0)));
|
||||
|
||||
forceLayout();
|
||||
*/
|
||||
}
|
||||
|
||||
private Menu createDownloadMenu() {
|
||||
|
@ -213,9 +218,9 @@ public class StorageChartTopPanel extends SimpleContainer {
|
|||
|
||||
private Menu createMeasureMenu() {
|
||||
Menu menuMeasure = new Menu();
|
||||
dataVolumeItem = new MenuItem("Data Volume");
|
||||
dataVolumeItem = new MenuItem(StorageChartMeasure.DataVolume.getLabel());
|
||||
dataVolumeItem.setHeight(30);
|
||||
operationCountItem = new MenuItem("Operation Count");
|
||||
operationCountItem = new MenuItem(StorageChartMeasure.OperationCount.getLabel());
|
||||
operationCountItem.setHeight(30);
|
||||
|
||||
dataVolumeItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
|
@ -479,7 +484,7 @@ public class StorageChartTopPanel extends SimpleContainer {
|
|||
return "[{" + " \"id\": \"" + StorageChartMeasure.DataVolume.name()
|
||||
+ "\"," + " \"labels\": {" + " \"format\": \"{value} "
|
||||
+ unitMeasureLabel + "\"," + " \"style\": {"
|
||||
+ " \"color\": \"" + colors.get(0) + "\"" + " }"
|
||||
+ " \"color\": \"" + colors.get(1) + "\"" + " }"
|
||||
+ " }," + " \"stackLabels\": {" + " \"enabled\": \"true\","
|
||||
+ " \"style\": {" + " \"fontWeight\": \"bold\","
|
||||
+ " \"color\": \"gray\"" + " } " + " },"
|
||||
|
@ -506,7 +511,7 @@ public class StorageChartTopPanel extends SimpleContainer {
|
|||
return "[{" + " \"id\": \"" + StorageChartMeasure.DataVolume.name()
|
||||
+ "\"," + " \"labels\": {" + " \"format\": \"{value} "
|
||||
+ unitMeasureLabel + "\"," + " \"style\": {"
|
||||
+ " \"color\": \"" + colors.get(0) + "\"" + " }"
|
||||
+ " \"color\": \"" + colors.get(1) + "\"" + " }"
|
||||
+ " }," + " \"stackLabels\": {" + " \"enabled\": \"true\","
|
||||
+ " \"style\": {" + " \"fontWeight\": \"bold\","
|
||||
+ " \"color\": \"gray\"" + " } " + " },"
|
||||
|
|
|
@ -147,6 +147,30 @@ public interface AccountingManagerResources extends ClientBundle {
|
|||
@Source("accounting-unit-TB_24.png")
|
||||
ImageResource accountingUnitTB24();
|
||||
|
||||
@Source("accounting-unit-ms_32.png")
|
||||
ImageResource accountingUnitms32();
|
||||
|
||||
@Source("accounting-unit-ms_24.png")
|
||||
ImageResource accountingUnitms24();
|
||||
|
||||
@Source("accounting-unit-s_32.png")
|
||||
ImageResource accountingUnits32();
|
||||
|
||||
@Source("accounting-unit-s_24.png")
|
||||
ImageResource accountingUnits24();
|
||||
|
||||
@Source("accounting-unit-m_32.png")
|
||||
ImageResource accountingUnitm32();
|
||||
|
||||
@Source("accounting-unit-m_24.png")
|
||||
ImageResource accountingUnitm24();
|
||||
|
||||
@Source("accounting-unit-h_32.png")
|
||||
ImageResource accountingUnith32();
|
||||
|
||||
@Source("accounting-unit-h_24.png")
|
||||
ImageResource accountingUnith24();
|
||||
|
||||
@Source("accounting-download_32.png")
|
||||
ImageResource accountingDownload32();
|
||||
|
||||
|
|
After Width: | Height: | Size: 616 B |
After Width: | Height: | Size: 841 B |
After Width: | Height: | Size: 685 B |
After Width: | Height: | Size: 958 B |
After Width: | Height: | Size: 960 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 636 B |
After Width: | Height: | Size: 901 B |
|
@ -68,6 +68,7 @@ public class AccountingQuery4Job extends AccountingQueryBuilder {
|
|||
|
||||
ArrayList<Filter> filters = null;
|
||||
ArrayList<AccountingFilter> accountingFilters = null;
|
||||
AccountingQuery invocation = null;
|
||||
|
||||
if (seriesRequest != null
|
||||
&& seriesRequest.getAccountingFilterDefinition() != null) {
|
||||
|
@ -75,27 +76,45 @@ public class AccountingQuery4Job extends AccountingQueryBuilder {
|
|||
AccountingFilterBasic accountingFilterBasic = (AccountingFilterBasic) seriesRequest
|
||||
.getAccountingFilterDefinition();
|
||||
accountingFilters = accountingFilterBasic.getFilters();
|
||||
filters = new ArrayList<Filter>();
|
||||
for (AccountingFilter accountigFilters : accountingFilters) {
|
||||
Filter filter = new Filter(accountigFilters.getFilterKey()
|
||||
.getKey(), accountigFilters.getFilterValue());
|
||||
filters.add(filter);
|
||||
}
|
||||
invocation = new AccountingQueryBasic(
|
||||
AggregatedJobUsageRecord.class, temporalConstraint,
|
||||
filters);
|
||||
|
||||
} else {
|
||||
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterTop) {
|
||||
AccountingFilterTop accountingFilterTop = (AccountingFilterTop) seriesRequest
|
||||
.getAccountingFilterDefinition();
|
||||
accountingFilters = accountingFilterTop.getFilters();
|
||||
filters = new ArrayList<Filter>();
|
||||
for (AccountingFilter accountigFilters : accountingFilters) {
|
||||
Filter filter = new Filter(accountigFilters
|
||||
.getFilterKey().getKey(),
|
||||
accountigFilters.getFilterValue());
|
||||
filters.add(filter);
|
||||
}
|
||||
invocation = new AccountingQueryTop(
|
||||
AggregatedJobUsageRecord.class,
|
||||
accountingFilterTop.getFilterKey(),
|
||||
accountingFilterTop.getTopNumber(),
|
||||
temporalConstraint, filters);
|
||||
} else {
|
||||
logger.error("Invalid Request: " + seriesRequest);
|
||||
throw new AccountingManagerServiceException(
|
||||
"Invalid Request!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (accountingFilters != null) {
|
||||
filters = new ArrayList<Filter>();
|
||||
for (AccountingFilter accountigFilters : accountingFilters) {
|
||||
Filter filter = new Filter(accountigFilters.getFilterKey()
|
||||
.getKey(), accountigFilters.getFilterValue());
|
||||
filters.add(filter);
|
||||
}
|
||||
} else {
|
||||
logger.error("Invalid Request: " + seriesRequest);
|
||||
throw new AccountingManagerServiceException("Invalid Request!");
|
||||
}
|
||||
|
||||
AccountingQueryBasic invocation = new AccountingQueryBasic(
|
||||
AggregatedJobUsageRecord.class, temporalConstraint, filters);
|
||||
|
||||
accountingQuerySpec.setOp(invocation);
|
||||
|
||||
}
|
||||
|
|
|
@ -68,6 +68,7 @@ public class AccountingQuery4Service extends AccountingQueryBuilder {
|
|||
|
||||
ArrayList<Filter> filters = null;
|
||||
ArrayList<AccountingFilter> accountingFilters = null;
|
||||
AccountingQuery invocation = null;
|
||||
|
||||
if (seriesRequest != null
|
||||
&& seriesRequest.getAccountingFilterDefinition() != null) {
|
||||
|
@ -75,27 +76,45 @@ public class AccountingQuery4Service extends AccountingQueryBuilder {
|
|||
AccountingFilterBasic accountingFilterBasic = (AccountingFilterBasic) seriesRequest
|
||||
.getAccountingFilterDefinition();
|
||||
accountingFilters = accountingFilterBasic.getFilters();
|
||||
filters = new ArrayList<Filter>();
|
||||
for (AccountingFilter accountigFilters : accountingFilters) {
|
||||
Filter filter = new Filter(accountigFilters.getFilterKey()
|
||||
.getKey(), accountigFilters.getFilterValue());
|
||||
filters.add(filter);
|
||||
}
|
||||
invocation = new AccountingQueryBasic(
|
||||
AggregatedServiceUsageRecord.class, temporalConstraint,
|
||||
filters);
|
||||
|
||||
} else {
|
||||
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterTop) {
|
||||
AccountingFilterTop accountingFilterTop = (AccountingFilterTop) seriesRequest
|
||||
.getAccountingFilterDefinition();
|
||||
accountingFilters = accountingFilterTop.getFilters();
|
||||
filters = new ArrayList<Filter>();
|
||||
for (AccountingFilter accountigFilters : accountingFilters) {
|
||||
Filter filter = new Filter(accountigFilters
|
||||
.getFilterKey().getKey(),
|
||||
accountigFilters.getFilterValue());
|
||||
filters.add(filter);
|
||||
}
|
||||
invocation = new AccountingQueryTop(
|
||||
AggregatedServiceUsageRecord.class,
|
||||
accountingFilterTop.getFilterKey(),
|
||||
accountingFilterTop.getTopNumber(),
|
||||
temporalConstraint, filters);
|
||||
} else {
|
||||
logger.error("Invalid Request: " + seriesRequest);
|
||||
throw new AccountingManagerServiceException(
|
||||
"Invalid Request!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (accountingFilters != null) {
|
||||
filters = new ArrayList<Filter>();
|
||||
for (AccountingFilter accountigFilters : accountingFilters) {
|
||||
Filter filter = new Filter(accountigFilters.getFilterKey()
|
||||
.getKey(), accountigFilters.getFilterValue());
|
||||
filters.add(filter);
|
||||
}
|
||||
} else {
|
||||
logger.error("Invalid Request: " + seriesRequest);
|
||||
throw new AccountingManagerServiceException("Invalid Request!");
|
||||
}
|
||||
|
||||
AccountingQueryBasic invocation = new AccountingQueryBasic(
|
||||
AggregatedServiceUsageRecord.class, temporalConstraint, filters);
|
||||
|
||||
accountingQuerySpec.setOp(invocation);
|
||||
|
||||
}
|
||||
|
|
|
@ -35,36 +35,40 @@ public class AccountingQuery4Storage extends AccountingQueryBuilder {
|
|||
|
||||
@Override
|
||||
public void buildOpEx() throws AccountingManagerServiceException {
|
||||
|
||||
Calendar startCalendar = GregorianCalendar.getInstance(TemporalConstraint.DEFAULT_TIME_ZONE);
|
||||
|
||||
Calendar startCalendar = GregorianCalendar
|
||||
.getInstance(TemporalConstraint.DEFAULT_TIME_ZONE);
|
||||
try {
|
||||
startCalendar.setTime(sdf.parse(seriesRequest.getAccountingPeriod().getStartDate()));
|
||||
startCalendar.setTime(sdf.parse(seriesRequest.getAccountingPeriod()
|
||||
.getStartDate()));
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
throw new AccountingManagerServiceException("Start Date not valid!");
|
||||
}
|
||||
|
||||
Calendar endCalendar = GregorianCalendar.getInstance(TemporalConstraint.DEFAULT_TIME_ZONE);
|
||||
|
||||
Calendar endCalendar = GregorianCalendar
|
||||
.getInstance(TemporalConstraint.DEFAULT_TIME_ZONE);
|
||||
try {
|
||||
endCalendar.setTime(sdf.parse(seriesRequest.getAccountingPeriod().getEndDate()));
|
||||
endCalendar.setTime(sdf.parse(seriesRequest.getAccountingPeriod()
|
||||
.getEndDate()));
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
throw new AccountingManagerServiceException("End Date not valid!");
|
||||
}
|
||||
|
||||
|
||||
endCalendar.set(GregorianCalendar.HOUR_OF_DAY, 23);
|
||||
endCalendar.set(GregorianCalendar.MINUTE, 59);
|
||||
endCalendar.set(GregorianCalendar.SECOND, 59);
|
||||
endCalendar.set(GregorianCalendar.MILLISECOND, 999);
|
||||
|
||||
|
||||
TemporalConstraint temporalConstraint = new TemporalConstraint(
|
||||
startCalendar.getTimeInMillis(),
|
||||
endCalendar.getTimeInMillis(),
|
||||
startCalendar.getTimeInMillis(), endCalendar.getTimeInMillis(),
|
||||
PeriodModeMap.getMode(seriesRequest.getAccountingPeriod()
|
||||
.getPeriod()));
|
||||
|
||||
ArrayList<Filter> filters = null;
|
||||
ArrayList<AccountingFilter> accountingFilters = null;
|
||||
AccountingQuery invocation = null;
|
||||
|
||||
if (seriesRequest != null
|
||||
&& seriesRequest.getAccountingFilterDefinition() != null) {
|
||||
|
@ -72,28 +76,45 @@ public class AccountingQuery4Storage extends AccountingQueryBuilder {
|
|||
AccountingFilterBasic accountingFilterBasic = (AccountingFilterBasic) seriesRequest
|
||||
.getAccountingFilterDefinition();
|
||||
accountingFilters = accountingFilterBasic.getFilters();
|
||||
filters = new ArrayList<Filter>();
|
||||
for (AccountingFilter accountigFilters : accountingFilters) {
|
||||
Filter filter = new Filter(accountigFilters.getFilterKey()
|
||||
.getKey(), accountigFilters.getFilterValue());
|
||||
filters.add(filter);
|
||||
}
|
||||
invocation = new AccountingQueryBasic(
|
||||
AggregatedStorageUsageRecord.class, temporalConstraint,
|
||||
filters);
|
||||
|
||||
} else {
|
||||
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterTop) {
|
||||
AccountingFilterTop accountingFilterTop = (AccountingFilterTop) seriesRequest
|
||||
.getAccountingFilterDefinition();
|
||||
accountingFilters = accountingFilterTop.getFilters();
|
||||
filters = new ArrayList<Filter>();
|
||||
for (AccountingFilter accountigFilters : accountingFilters) {
|
||||
Filter filter = new Filter(accountigFilters
|
||||
.getFilterKey().getKey(),
|
||||
accountigFilters.getFilterValue());
|
||||
filters.add(filter);
|
||||
}
|
||||
invocation = new AccountingQueryTop(
|
||||
AggregatedStorageUsageRecord.class,
|
||||
accountingFilterTop.getFilterKey(),
|
||||
accountingFilterTop.getTopNumber(),
|
||||
temporalConstraint, filters);
|
||||
} else {
|
||||
logger.error("Invalid Request: " + seriesRequest);
|
||||
throw new AccountingManagerServiceException(
|
||||
"Invalid Request!");
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
logger.error("Invalid Request: " + seriesRequest);
|
||||
throw new AccountingManagerServiceException("Invalid Request!");
|
||||
}
|
||||
|
||||
if (accountingFilters != null) {
|
||||
filters = new ArrayList<Filter>();
|
||||
for (AccountingFilter accountigFilters : accountingFilters) {
|
||||
Filter filter = new Filter(accountigFilters.getFilterKey()
|
||||
.getKey(), accountigFilters.getFilterValue());
|
||||
filters.add(filter);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
AccountingQueryBasic invocation = new AccountingQueryBasic(
|
||||
AggregatedStorageUsageRecord.class, temporalConstraint, filters);
|
||||
|
||||
accountingQuerySpec.setOp(invocation);
|
||||
|
||||
}
|
||||
|
|
After Width: | Height: | Size: 616 B |
After Width: | Height: | Size: 841 B |
After Width: | Height: | Size: 685 B |
After Width: | Height: | Size: 958 B |
After Width: | Height: | Size: 960 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 636 B |
After Width: | Height: | Size: 901 B |