2251: Accounting Manager - Stacked column chart for tops
Task-Url: https://support.d4science.org/issues/2251 Updated Stacked on Service git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/admin/accounting-manager@124354 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
3afb964d28
commit
d2c22d7f9f
|
@ -54,12 +54,14 @@ public class JobChartBasicPanel extends SimpleContainer {
|
|||
private AccountingStateData accountingStateData;
|
||||
private HighchartsLayoutPanel highchartsLayoutPanel;
|
||||
|
||||
// Replace Menu
|
||||
// Download Menu
|
||||
private MenuItem downloadPNGItem;
|
||||
private MenuItem downloadJPGItem;
|
||||
private MenuItem downloadPDFItem;
|
||||
private MenuItem downloadSVGItem;
|
||||
ChartOptions options;
|
||||
|
||||
|
||||
private ChartOptions options;
|
||||
|
||||
public JobChartBasicPanel(AccountingStateData accountingStateData) {
|
||||
this.accountingStateData = accountingStateData;
|
||||
|
|
|
@ -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.ServiceChartMeasure;
|
||||
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.SeriesService;
|
||||
|
@ -48,18 +49,33 @@ import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
|
|||
*
|
||||
*/
|
||||
public class ServiceChartBasicPanel 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;
|
||||
|
||||
// Replace Menu
|
||||
// Download Menu
|
||||
private MenuItem downloadPNGItem;
|
||||
private MenuItem downloadJPGItem;
|
||||
private MenuItem downloadPDFItem;
|
||||
private MenuItem downloadSVGItem;
|
||||
ChartOptions options;
|
||||
|
||||
// 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 ServiceChartBasicPanel(AccountingStateData accountingStateData) {
|
||||
this.accountingStateData = accountingStateData;
|
||||
|
@ -72,18 +88,22 @@ public class ServiceChartBasicPanel 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.accountingUnitkB24());
|
||||
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);
|
||||
|
@ -93,27 +113,22 @@ public class ServiceChartBasicPanel extends SimpleContainer {
|
|||
|
||||
@Override
|
||||
public void onSelect(SelectEvent event) {
|
||||
if (toggleButton.getValue()) {
|
||||
createSingleAxisChart();
|
||||
highchartsLayoutPanel.renderChart(options);
|
||||
} else {
|
||||
createMultiAxisChart();
|
||||
highchartsLayoutPanel.renderChart(options);
|
||||
}
|
||||
forceLayout();
|
||||
updateChart();
|
||||
}
|
||||
});
|
||||
|
||||
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)));
|
||||
|
@ -122,26 +137,115 @@ public class ServiceChartBasicPanel extends SimpleContainer {
|
|||
|
||||
}
|
||||
|
||||
private void updateChart() {
|
||||
if (toggleButton.getValue()) {
|
||||
createSingleAxisChart();
|
||||
highchartsLayoutPanel.renderChart(options);
|
||||
} else {
|
||||
createMultiAxisChart();
|
||||
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());
|
||||
msItem.setHeight(30);
|
||||
sItem = new MenuItem(TimeUnitMeasure.SECONDS,
|
||||
AccountingManagerResources.INSTANCE.accountingUnitMB24());
|
||||
sItem.setHeight(30);
|
||||
mItem = new MenuItem(TimeUnitMeasure.MINUTES,
|
||||
AccountingManagerResources.INSTANCE.accountingUnitGB24());
|
||||
mItem.setHeight(30);
|
||||
hItem = new MenuItem(TimeUnitMeasure.HOURS,
|
||||
AccountingManagerResources.INSTANCE.accountingUnitTB24());
|
||||
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
|
||||
.accountingUnitkB24());
|
||||
updateChart();
|
||||
}
|
||||
});
|
||||
|
||||
sItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
|
||||
@Override
|
||||
public void onSelection(SelectionEvent<Item> event) {
|
||||
unitMeasure = TimeUnitMeasure.getSeconds();
|
||||
unitMeasureLabel = TimeUnitMeasure.S;
|
||||
unitButton.setIcon(AccountingManagerResources.INSTANCE
|
||||
.accountingUnitMB24());
|
||||
updateChart();
|
||||
}
|
||||
});
|
||||
|
||||
mItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
|
||||
@Override
|
||||
public void onSelection(SelectionEvent<Item> event) {
|
||||
unitMeasure = TimeUnitMeasure.getMinutes();
|
||||
unitMeasureLabel = TimeUnitMeasure.M;
|
||||
unitButton.setIcon(AccountingManagerResources.INSTANCE
|
||||
.accountingUnitGB24());
|
||||
updateChart();
|
||||
}
|
||||
});
|
||||
|
||||
hItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
|
||||
@Override
|
||||
public void onSelection(SelectionEvent<Item> event) {
|
||||
unitMeasure = TimeUnitMeasure.getHours();
|
||||
unitMeasureLabel = TimeUnitMeasure.H;
|
||||
unitButton.setIcon(AccountingManagerResources.INSTANCE
|
||||
.accountingUnitTB24());
|
||||
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>() {
|
||||
|
||||
|
@ -243,12 +347,13 @@ public class ServiceChartBasicPanel extends SimpleContainer {
|
|||
private void createMultiAxisChart() {
|
||||
SeriesService seriesService = (SeriesService) accountingStateData
|
||||
.getSeriesResponse();
|
||||
|
||||
if(!(seriesService.getSerieServiceDefinition() instanceof SeriesServiceBasic)){
|
||||
//throw new Exception("Invalid SeriesServiceBasic!");
|
||||
|
||||
if (!(seriesService.getSerieServiceDefinition() instanceof SeriesServiceBasic)) {
|
||||
Log.error("Invalid SeriesServiceBasic!");
|
||||
return;
|
||||
}
|
||||
SeriesServiceBasic seriesServiceBasic=(SeriesServiceBasic)seriesService.getSerieServiceDefinition();
|
||||
SeriesServiceBasic seriesServiceBasic = (SeriesServiceBasic) seriesService
|
||||
.getSerieServiceDefinition();
|
||||
|
||||
double minRange = ChartTimeMeasure
|
||||
.calculateMinRange(accountingStateData.getSeriesRequest()
|
||||
|
@ -257,10 +362,10 @@ public class ServiceChartBasicPanel 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);
|
||||
|
||||
|
@ -270,11 +375,9 @@ public class ServiceChartBasicPanel extends SimpleContainer {
|
|||
|
||||
HighchartsOptionFactory highchartsFactory = new JsoHighchartsOptionFactory();
|
||||
options = highchartsFactory.createChartOptions();
|
||||
|
||||
options.chart().zoomType("xy");
|
||||
options.navigation().buttonOptions().enabled(false);
|
||||
options.exporting().filename("AccountingServiceBasic");
|
||||
options.chart().zoomType("xy");
|
||||
|
||||
options.title().text("Accounting Service");
|
||||
|
||||
/*
|
||||
|
@ -289,80 +392,41 @@ public class ServiceChartBasicPanel extends SimpleContainer {
|
|||
options.xAxis().type("datetime").minRange(minRange);
|
||||
|
||||
// yAxis
|
||||
String multiAxis = "[{" + " \"id\": \""+ServiceChartMeasure.OperationCount.name()+"\","
|
||||
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\""
|
||||
+ " \"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} " + unitMeasureLabel + "\","
|
||||
+ " \"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} " + unitMeasureLabel + "\","
|
||||
+ " \"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} " + unitMeasureLabel + "\","
|
||||
+ " \"style\": {" + " \"color\": \"" + colors.get(3)
|
||||
+ "\"" + " }" + " }," + " \"opposite\": \"true\""
|
||||
+ ", \"showFirstLabel\": \"false\"" + "}]"
|
||||
|
||||
;
|
||||
|
@ -381,7 +445,8 @@ public class ServiceChartBasicPanel extends SimpleContainer {
|
|||
|
||||
SeriesColumn seriesOperationCount = highchartsFactory
|
||||
.createSeriesColumn();
|
||||
seriesOperationCount.name(ServiceChartMeasure.OperationCount.getLabel());
|
||||
seriesOperationCount
|
||||
.name(ServiceChartMeasure.OperationCount.getLabel());
|
||||
seriesOperationCount.color(colors.get(1));
|
||||
seriesOperationCount.type("column");
|
||||
|
||||
|
@ -402,9 +467,11 @@ public class ServiceChartBasicPanel extends SimpleContainer {
|
|||
|
||||
SeriesArea seriesMaxInvocationTime = highchartsFactory
|
||||
.createSeriesArea();
|
||||
seriesMaxInvocationTime.name(ServiceChartMeasure.MaxInvocationTime.getLabel());
|
||||
seriesMaxInvocationTime.name(ServiceChartMeasure.MaxInvocationTime
|
||||
.getLabel());
|
||||
seriesMaxInvocationTime.color(colors.get(2));
|
||||
seriesMaxInvocationTime.yAxisAsString(ServiceChartMeasure.MaxInvocationTime.name());
|
||||
seriesMaxInvocationTime
|
||||
.yAxisAsString(ServiceChartMeasure.MaxInvocationTime.name());
|
||||
|
||||
ArrayNumber dataMaxInvocationTime = seriesMaxInvocationTime
|
||||
.dataAsArrayNumber();
|
||||
|
@ -414,9 +481,11 @@ public class ServiceChartBasicPanel extends SimpleContainer {
|
|||
|
||||
SeriesArea seriesMinInvocationTime = highchartsFactory
|
||||
.createSeriesArea();
|
||||
seriesMinInvocationTime.name(ServiceChartMeasure.MinInvocationTime.getLabel());
|
||||
seriesMinInvocationTime.name(ServiceChartMeasure.MinInvocationTime
|
||||
.getLabel());
|
||||
seriesMinInvocationTime.color(colors.get(3));
|
||||
seriesMinInvocationTime.yAxisAsString(ServiceChartMeasure.MinInvocationTime.name());
|
||||
seriesMinInvocationTime
|
||||
.yAxisAsString(ServiceChartMeasure.MinInvocationTime.name());
|
||||
|
||||
ArrayNumber dataMinInvocationTime = seriesMinInvocationTime
|
||||
.dataAsArrayNumber();
|
||||
|
@ -424,13 +493,14 @@ public class ServiceChartBasicPanel extends SimpleContainer {
|
|||
seriesMinInvocationTime.pointInterval(interval).pointStart(
|
||||
dateStart.getTime());
|
||||
|
||||
for (SeriesServiceData seriesServiceData : seriesServiceBasic.getSeries()) {
|
||||
for (SeriesServiceData seriesServiceData : seriesServiceBasic
|
||||
.getSeries()) {
|
||||
dataOperationCount.push(seriesServiceData.getOperationCount());
|
||||
dataDuration.push(seriesServiceData.getDuration());
|
||||
dataMaxInvocationTime
|
||||
.push(seriesServiceData.getMaxInvocationTime());
|
||||
dataMinInvocationTime
|
||||
.push(seriesServiceData.getMinInvocationTime());
|
||||
dataDuration.push(seriesServiceData.getDuration() / unitMeasure);
|
||||
dataMaxInvocationTime.push(seriesServiceData.getMaxInvocationTime()
|
||||
/ unitMeasure);
|
||||
dataMinInvocationTime.push(seriesServiceData.getMinInvocationTime()
|
||||
/ unitMeasure);
|
||||
}
|
||||
|
||||
options.series().addToEnd(seriesOperationCount);
|
||||
|
@ -441,27 +511,19 @@ public class ServiceChartBasicPanel 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() {
|
||||
SeriesService seriesService = (SeriesService) accountingStateData
|
||||
.getSeriesResponse();
|
||||
|
||||
if(!(seriesService.getSerieServiceDefinition() instanceof SeriesServiceBasic)){
|
||||
|
||||
if (!(seriesService.getSerieServiceDefinition() instanceof SeriesServiceBasic)) {
|
||||
Log.debug("Invalid SeriesServiceBasic!");
|
||||
return;
|
||||
}
|
||||
SeriesServiceBasic seriesServiceBasic=(SeriesServiceBasic)seriesService.getSerieServiceDefinition();
|
||||
SeriesServiceBasic seriesServiceBasic = (SeriesServiceBasic) seriesService
|
||||
.getSerieServiceDefinition();
|
||||
|
||||
double minRange = ChartTimeMeasure
|
||||
.calculateMinRange(accountingStateData.getSeriesRequest()
|
||||
|
@ -470,10 +532,10 @@ public class ServiceChartBasicPanel 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);
|
||||
|
||||
|
@ -483,7 +545,7 @@ public class ServiceChartBasicPanel extends SimpleContainer {
|
|||
|
||||
HighchartsOptionFactory highchartsFactory = new JsoHighchartsOptionFactory();
|
||||
options = highchartsFactory.createChartOptions();
|
||||
|
||||
|
||||
options.navigation().buttonOptions().enabled(false);
|
||||
options.exporting().filename("AccountingService");
|
||||
options.chart().zoomType("xy");
|
||||
|
@ -505,41 +567,25 @@ public class ServiceChartBasicPanel extends SimpleContainer {
|
|||
// options.yAxis().title().text("Exchange rate");
|
||||
// Highcharts.getOptions().colors[0]
|
||||
|
||||
String multiAxis = "[{" + " \"id\": \""+ServiceChartMeasure.OperationCount.name()+"\","
|
||||
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\""
|
||||
// +
|
||||
+ " \"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} "
|
||||
+ unitMeasureLabel + "\"," + " \"style\": {"
|
||||
+ " \"color\": \"" + colors.get(1) + "\"" + " }"
|
||||
+ " }," + " \"opposite\": \"true\"" + // +
|
||||
// ", \"showFirstLabel\": \"false\""
|
||||
// +
|
||||
"}]";
|
||||
|
||||
options.setFieldAsJsonObject("yAxis", multiAxis);
|
||||
|
@ -556,7 +602,8 @@ public class ServiceChartBasicPanel extends SimpleContainer {
|
|||
|
||||
SeriesColumn seriesOperationCount = highchartsFactory
|
||||
.createSeriesColumn();
|
||||
seriesOperationCount.name(ServiceChartMeasure.OperationCount.getLabel());
|
||||
seriesOperationCount
|
||||
.name(ServiceChartMeasure.OperationCount.getLabel());
|
||||
seriesOperationCount.color(colors.get(1));
|
||||
seriesOperationCount.type("column");
|
||||
|
||||
|
@ -576,7 +623,8 @@ public class ServiceChartBasicPanel extends SimpleContainer {
|
|||
|
||||
SeriesArea seriesMaxInvocationTime = highchartsFactory
|
||||
.createSeriesArea();
|
||||
seriesMaxInvocationTime.name(ServiceChartMeasure.MaxInvocationTime.getLabel());
|
||||
seriesMaxInvocationTime.name(ServiceChartMeasure.MaxInvocationTime
|
||||
.getLabel());
|
||||
seriesMaxInvocationTime.color(colors.get(2));
|
||||
|
||||
ArrayNumber dataMaxInvocationTime = seriesMaxInvocationTime
|
||||
|
@ -587,7 +635,8 @@ public class ServiceChartBasicPanel extends SimpleContainer {
|
|||
|
||||
SeriesArea seriesMinInvocationTime = highchartsFactory
|
||||
.createSeriesArea();
|
||||
seriesMinInvocationTime.name(ServiceChartMeasure.MinInvocationTime.getLabel());
|
||||
seriesMinInvocationTime.name(ServiceChartMeasure.MinInvocationTime
|
||||
.getLabel());
|
||||
seriesMinInvocationTime.color(colors.get(3));
|
||||
// seriesMinInvocationTime.yAxisAsString("MinInvocationTime");
|
||||
|
||||
|
@ -597,13 +646,14 @@ public class ServiceChartBasicPanel extends SimpleContainer {
|
|||
seriesMinInvocationTime.pointInterval(interval).pointStart(
|
||||
dateStart.getTime());
|
||||
|
||||
for (SeriesServiceData seriesServiceData : seriesServiceBasic.getSeries()) {
|
||||
for (SeriesServiceData seriesServiceData : seriesServiceBasic
|
||||
.getSeries()) {
|
||||
dataOperationCount.push(seriesServiceData.getOperationCount());
|
||||
dataDuration.push(seriesServiceData.getDuration());
|
||||
dataMaxInvocationTime
|
||||
.push(seriesServiceData.getMaxInvocationTime());
|
||||
dataMinInvocationTime
|
||||
.push(seriesServiceData.getMinInvocationTime());
|
||||
dataDuration.push(seriesServiceData.getDuration() / unitMeasure);
|
||||
dataMaxInvocationTime.push(seriesServiceData.getMaxInvocationTime()
|
||||
/ unitMeasure);
|
||||
dataMinInvocationTime.push(seriesServiceData.getMinInvocationTime()
|
||||
/ unitMeasure);
|
||||
}
|
||||
|
||||
options.series().addToEnd(seriesOperationCount);
|
||||
|
|
|
@ -49,18 +49,26 @@ 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 MEASURE_TYPE = "Measure";
|
||||
|
||||
private static final String SINGLE_AXIS = "Single Axis";
|
||||
|
||||
private DateTimeFormat dtf=DateTimeFormat.getFormat(PredefinedFormat.YEAR_MONTH_DAY);
|
||||
|
||||
private DateTimeFormat dtf = DateTimeFormat
|
||||
.getFormat(PredefinedFormat.YEAR_MONTH_DAY);
|
||||
private AccountingStateData accountingStateData;
|
||||
private HighchartsLayoutPanel highchartsLayoutPanel;
|
||||
|
||||
// Replace Menu
|
||||
// Download Menu
|
||||
private MenuItem downloadPNGItem;
|
||||
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;
|
||||
|
||||
public ServiceChartTopPanel(AccountingStateData accountingStateData) {
|
||||
|
@ -74,9 +82,9 @@ public class ServiceChartTopPanel 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);
|
||||
|
@ -110,7 +118,7 @@ public class ServiceChartTopPanel extends SimpleContainer {
|
|||
|
||||
//
|
||||
createMultiAxisChart();
|
||||
|
||||
|
||||
highchartsLayoutPanel = new HighchartsLayoutPanel();
|
||||
highchartsLayoutPanel.renderChart(options);
|
||||
|
||||
|
@ -128,22 +136,17 @@ public class ServiceChartTopPanel extends SimpleContainer {
|
|||
|
||||
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,13 +248,13 @@ public class ServiceChartTopPanel extends SimpleContainer {
|
|||
private void createMultiAxisChart() {
|
||||
SeriesService seriesService = (SeriesService) accountingStateData
|
||||
.getSeriesResponse();
|
||||
|
||||
if(!(seriesService.getSerieServiceDefinition() instanceof SeriesServiceTop)){
|
||||
|
||||
if (!(seriesService.getSerieServiceDefinition() instanceof SeriesServiceTop)) {
|
||||
Log.debug("Invalid SeriesServiceTop!");
|
||||
return;
|
||||
}
|
||||
SeriesServiceTop seriesServiceTop=(SeriesServiceTop)seriesService.getSerieServiceDefinition();
|
||||
|
||||
SeriesServiceTop seriesServiceTop = (SeriesServiceTop) seriesService
|
||||
.getSerieServiceDefinition();
|
||||
|
||||
double minRange = ChartTimeMeasure
|
||||
.calculateMinRange(accountingStateData.getSeriesRequest()
|
||||
|
@ -260,10 +263,10 @@ public class ServiceChartTopPanel 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);
|
||||
|
||||
|
@ -292,80 +295,41 @@ public class ServiceChartTopPanel extends SimpleContainer {
|
|||
options.xAxis().type("datetime").minRange(minRange);
|
||||
|
||||
// yAxis
|
||||
String multiAxis = "[{" + " \"id\": \""+ServiceChartMeasure.OperationCount.name()+"\","
|
||||
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\""
|
||||
+ " \"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\"" + "}]"
|
||||
|
||||
;
|
||||
|
@ -384,7 +348,8 @@ public class ServiceChartTopPanel extends SimpleContainer {
|
|||
|
||||
SeriesColumn seriesOperationCount = highchartsFactory
|
||||
.createSeriesColumn();
|
||||
seriesOperationCount.name(ServiceChartMeasure.OperationCount.getLabel());
|
||||
seriesOperationCount
|
||||
.name(ServiceChartMeasure.OperationCount.getLabel());
|
||||
seriesOperationCount.color(colors.get(1));
|
||||
seriesOperationCount.type("column");
|
||||
|
||||
|
@ -405,9 +370,11 @@ public class ServiceChartTopPanel extends SimpleContainer {
|
|||
|
||||
SeriesArea seriesMaxInvocationTime = highchartsFactory
|
||||
.createSeriesArea();
|
||||
seriesMaxInvocationTime.name(ServiceChartMeasure.MaxInvocationTime.getLabel());
|
||||
seriesMaxInvocationTime.name(ServiceChartMeasure.MaxInvocationTime
|
||||
.getLabel());
|
||||
seriesMaxInvocationTime.color(colors.get(2));
|
||||
seriesMaxInvocationTime.yAxisAsString(ServiceChartMeasure.MaxInvocationTime.name());
|
||||
seriesMaxInvocationTime
|
||||
.yAxisAsString(ServiceChartMeasure.MaxInvocationTime.name());
|
||||
|
||||
ArrayNumber dataMaxInvocationTime = seriesMaxInvocationTime
|
||||
.dataAsArrayNumber();
|
||||
|
@ -417,9 +384,11 @@ public class ServiceChartTopPanel extends SimpleContainer {
|
|||
|
||||
SeriesArea seriesMinInvocationTime = highchartsFactory
|
||||
.createSeriesArea();
|
||||
seriesMinInvocationTime.name(ServiceChartMeasure.MinInvocationTime.getLabel());
|
||||
seriesMinInvocationTime.name(ServiceChartMeasure.MinInvocationTime
|
||||
.getLabel());
|
||||
seriesMinInvocationTime.color(colors.get(3));
|
||||
seriesMinInvocationTime.yAxisAsString(ServiceChartMeasure.MinInvocationTime.name());
|
||||
seriesMinInvocationTime
|
||||
.yAxisAsString(ServiceChartMeasure.MinInvocationTime.name());
|
||||
|
||||
ArrayNumber dataMinInvocationTime = seriesMinInvocationTime
|
||||
.dataAsArrayNumber();
|
||||
|
@ -427,7 +396,8 @@ public class ServiceChartTopPanel extends SimpleContainer {
|
|||
seriesMinInvocationTime.pointInterval(interval).pointStart(
|
||||
dateStart.getTime());
|
||||
|
||||
for (SeriesServiceData seriesServiceData : seriesServiceTop.getSeriesServiceDataTopList().get(0).getSeries()) {
|
||||
for (SeriesServiceData seriesServiceData : seriesServiceTop
|
||||
.getSeriesServiceDataTopList().get(0).getSeries()) {
|
||||
dataOperationCount.push(seriesServiceData.getOperationCount());
|
||||
dataDuration.push(seriesServiceData.getDuration());
|
||||
dataMaxInvocationTime
|
||||
|
@ -459,14 +429,14 @@ public class ServiceChartTopPanel extends SimpleContainer {
|
|||
private void createSingleAxisChart() {
|
||||
SeriesService seriesService = (SeriesService) accountingStateData
|
||||
.getSeriesResponse();
|
||||
|
||||
if(!(seriesService.getSerieServiceDefinition() instanceof SeriesServiceTop)){
|
||||
|
||||
if (!(seriesService.getSerieServiceDefinition() instanceof SeriesServiceTop)) {
|
||||
Log.debug("Invalid SeriesServiceTop!");
|
||||
return;
|
||||
}
|
||||
SeriesServiceTop seriesServiceTop=(SeriesServiceTop)seriesService.getSerieServiceDefinition();
|
||||
SeriesServiceTop seriesServiceTop = (SeriesServiceTop) seriesService
|
||||
.getSerieServiceDefinition();
|
||||
|
||||
|
||||
double minRange = ChartTimeMeasure
|
||||
.calculateMinRange(accountingStateData.getSeriesRequest()
|
||||
.getAccountingPeriod());
|
||||
|
@ -474,10 +444,10 @@ public class ServiceChartTopPanel 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);
|
||||
|
||||
|
@ -487,7 +457,7 @@ public class ServiceChartTopPanel extends SimpleContainer {
|
|||
|
||||
HighchartsOptionFactory highchartsFactory = new JsoHighchartsOptionFactory();
|
||||
options = highchartsFactory.createChartOptions();
|
||||
|
||||
|
||||
options.navigation().buttonOptions().enabled(false);
|
||||
options.exporting().filename("AccountingService");
|
||||
options.chart().zoomType("xy");
|
||||
|
@ -509,38 +479,21 @@ public class ServiceChartTopPanel extends SimpleContainer {
|
|||
// options.yAxis().title().text("Exchange rate");
|
||||
// Highcharts.getOptions().colors[0]
|
||||
|
||||
String multiAxis = "[{" + " \"id\": \""+ServiceChartMeasure.OperationCount.name()+"\","
|
||||
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)
|
||||
+ " \"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\""
|
||||
// +
|
||||
|
@ -560,7 +513,8 @@ public class ServiceChartTopPanel extends SimpleContainer {
|
|||
|
||||
SeriesColumn seriesOperationCount = highchartsFactory
|
||||
.createSeriesColumn();
|
||||
seriesOperationCount.name(ServiceChartMeasure.OperationCount.getLabel());
|
||||
seriesOperationCount
|
||||
.name(ServiceChartMeasure.OperationCount.getLabel());
|
||||
seriesOperationCount.color(colors.get(1));
|
||||
seriesOperationCount.type("column");
|
||||
|
||||
|
@ -580,7 +534,8 @@ public class ServiceChartTopPanel extends SimpleContainer {
|
|||
|
||||
SeriesArea seriesMaxInvocationTime = highchartsFactory
|
||||
.createSeriesArea();
|
||||
seriesMaxInvocationTime.name(ServiceChartMeasure.MaxInvocationTime.getLabel());
|
||||
seriesMaxInvocationTime.name(ServiceChartMeasure.MaxInvocationTime
|
||||
.getLabel());
|
||||
seriesMaxInvocationTime.color(colors.get(2));
|
||||
|
||||
ArrayNumber dataMaxInvocationTime = seriesMaxInvocationTime
|
||||
|
@ -591,7 +546,8 @@ public class ServiceChartTopPanel extends SimpleContainer {
|
|||
|
||||
SeriesArea seriesMinInvocationTime = highchartsFactory
|
||||
.createSeriesArea();
|
||||
seriesMinInvocationTime.name(ServiceChartMeasure.MinInvocationTime.getLabel());
|
||||
seriesMinInvocationTime.name(ServiceChartMeasure.MinInvocationTime
|
||||
.getLabel());
|
||||
seriesMinInvocationTime.color(colors.get(3));
|
||||
// seriesMinInvocationTime.yAxisAsString("MinInvocationTime");
|
||||
|
||||
|
@ -601,7 +557,8 @@ public class ServiceChartTopPanel extends SimpleContainer {
|
|||
seriesMinInvocationTime.pointInterval(interval).pointStart(
|
||||
dateStart.getTime());
|
||||
|
||||
for (SeriesServiceData seriesServiceData : seriesServiceTop.getSeriesServiceDataTopList().get(0).getSeries()) {
|
||||
for (SeriesServiceData seriesServiceData : seriesServiceTop
|
||||
.getSeriesServiceDataTopList().get(0).getSeries()) {
|
||||
dataOperationCount.push(seriesServiceData.getOperationCount());
|
||||
dataDuration.push(seriesServiceData.getDuration());
|
||||
dataMaxInvocationTime
|
||||
|
|
|
@ -67,14 +67,13 @@ public class StorageChartBasicPanel extends SimpleContainer {
|
|||
private MenuItem GBItem;
|
||||
private MenuItem TBItem;
|
||||
|
||||
private ChartOptions options;
|
||||
|
||||
private VerticalLayoutContainer vert;
|
||||
private long unitMeasure = ByteUnitMeasure.getMegaByteDimForStorage();
|
||||
private String unitMeasureLabel = ByteUnitMeasure.MB;
|
||||
|
||||
private TextButton unitButton;
|
||||
|
||||
private ChartOptions options;
|
||||
private VerticalLayoutContainer vert;
|
||||
|
||||
public StorageChartBasicPanel(AccountingStateData accountingStateData) {
|
||||
this.accountingStateData = accountingStateData;
|
||||
forceLayoutOnResize = true;
|
||||
|
@ -133,66 +132,6 @@ public class StorageChartBasicPanel extends SimpleContainer {
|
|||
forceLayout();
|
||||
}
|
||||
|
||||
private Menu createDownloadMenu() {
|
||||
Menu menuDownload = new Menu();
|
||||
downloadPNGItem = new MenuItem(DownloadConstants.DOWNLOAD_PNG,
|
||||
AccountingManagerResources.INSTANCE.accountingFilePNG24());
|
||||
downloadPNGItem.setHeight(30);
|
||||
downloadJPGItem = new MenuItem(DownloadConstants.DOWNLOAD_JPG,
|
||||
AccountingManagerResources.INSTANCE.accountingFileJPG24());
|
||||
downloadJPGItem.setHeight(30);
|
||||
downloadPDFItem = new MenuItem(DownloadConstants.DOWNLOAD_PDF,
|
||||
AccountingManagerResources.INSTANCE.accountingFilePDF24());
|
||||
downloadPDFItem.setHeight(30);
|
||||
downloadSVGItem = new MenuItem(DownloadConstants.DOWNLOAD_SVG,
|
||||
AccountingManagerResources.INSTANCE.accountingFileSVG24());
|
||||
downloadSVGItem.setHeight(30);
|
||||
|
||||
downloadPNGItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
|
||||
@Override
|
||||
public void onSelection(SelectionEvent<Item> event) {
|
||||
String id = highchartsLayoutPanel.getElement().getId();
|
||||
onDownloadPNG(id);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
downloadJPGItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
|
||||
@Override
|
||||
public void onSelection(SelectionEvent<Item> event) {
|
||||
String id = highchartsLayoutPanel.getElement().getId();
|
||||
onDownloadJPG(id);
|
||||
}
|
||||
});
|
||||
|
||||
downloadPDFItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
|
||||
@Override
|
||||
public void onSelection(SelectionEvent<Item> event) {
|
||||
String id = highchartsLayoutPanel.getElement().getId();
|
||||
onDownloadPDF(id);
|
||||
}
|
||||
});
|
||||
|
||||
downloadSVGItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
|
||||
@Override
|
||||
public void onSelection(SelectionEvent<Item> event) {
|
||||
String id = highchartsLayoutPanel.getElement().getId();
|
||||
onDownloadSVG(id);
|
||||
}
|
||||
});
|
||||
|
||||
menuDownload.add(downloadPNGItem);
|
||||
menuDownload.add(downloadJPGItem);
|
||||
menuDownload.add(downloadPDFItem);
|
||||
menuDownload.add(downloadSVGItem);
|
||||
return menuDownload;
|
||||
|
||||
}
|
||||
|
||||
private Menu createUnitMenu() {
|
||||
Menu menuUnit = new Menu();
|
||||
kBItem = new MenuItem(ByteUnitMeasure.KILOBYTE,
|
||||
|
@ -264,6 +203,66 @@ public class StorageChartBasicPanel extends SimpleContainer {
|
|||
|
||||
}
|
||||
|
||||
private Menu createDownloadMenu() {
|
||||
Menu menuDownload = new Menu();
|
||||
downloadPNGItem = new MenuItem(DownloadConstants.DOWNLOAD_PNG,
|
||||
AccountingManagerResources.INSTANCE.accountingFilePNG24());
|
||||
downloadPNGItem.setHeight(30);
|
||||
downloadJPGItem = new MenuItem(DownloadConstants.DOWNLOAD_JPG,
|
||||
AccountingManagerResources.INSTANCE.accountingFileJPG24());
|
||||
downloadJPGItem.setHeight(30);
|
||||
downloadPDFItem = new MenuItem(DownloadConstants.DOWNLOAD_PDF,
|
||||
AccountingManagerResources.INSTANCE.accountingFilePDF24());
|
||||
downloadPDFItem.setHeight(30);
|
||||
downloadSVGItem = new MenuItem(DownloadConstants.DOWNLOAD_SVG,
|
||||
AccountingManagerResources.INSTANCE.accountingFileSVG24());
|
||||
downloadSVGItem.setHeight(30);
|
||||
|
||||
downloadPNGItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
|
||||
@Override
|
||||
public void onSelection(SelectionEvent<Item> event) {
|
||||
String id = highchartsLayoutPanel.getElement().getId();
|
||||
onDownloadPNG(id);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
downloadJPGItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
|
||||
@Override
|
||||
public void onSelection(SelectionEvent<Item> event) {
|
||||
String id = highchartsLayoutPanel.getElement().getId();
|
||||
onDownloadJPG(id);
|
||||
}
|
||||
});
|
||||
|
||||
downloadPDFItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
|
||||
@Override
|
||||
public void onSelection(SelectionEvent<Item> event) {
|
||||
String id = highchartsLayoutPanel.getElement().getId();
|
||||
onDownloadPDF(id);
|
||||
}
|
||||
});
|
||||
|
||||
downloadSVGItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
|
||||
@Override
|
||||
public void onSelection(SelectionEvent<Item> event) {
|
||||
String id = highchartsLayoutPanel.getElement().getId();
|
||||
onDownloadSVG(id);
|
||||
}
|
||||
});
|
||||
|
||||
menuDownload.add(downloadPNGItem);
|
||||
menuDownload.add(downloadJPGItem);
|
||||
menuDownload.add(downloadPDFItem);
|
||||
menuDownload.add(downloadSVGItem);
|
||||
return menuDownload;
|
||||
|
||||
}
|
||||
|
||||
// chart.options.exporting.buttons.contextButton.menuItems[0].onclick();
|
||||
|
||||
public static native void onDownloadPNG(String id) /*-{
|
||||
|
@ -321,7 +320,7 @@ public class StorageChartBasicPanel extends SimpleContainer {
|
|||
.getSeriesResponse();
|
||||
|
||||
if (!(seriesStorage.getSeriesStorageDefinition() instanceof SeriesStorageBasic)) {
|
||||
Log.debug("Invalid SeriesStorageBasic!");
|
||||
Log.error("Invalid SeriesStorageBasic!");
|
||||
return;
|
||||
}
|
||||
SeriesStorageBasic seriesStorageBasic = (SeriesStorageBasic) seriesStorage
|
||||
|
@ -434,15 +433,6 @@ public class StorageChartBasicPanel 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -72,15 +72,16 @@ public class StorageChartTopPanel extends SimpleContainer {
|
|||
private MenuItem GBItem;
|
||||
private MenuItem TBItem;
|
||||
|
||||
private long unitMeasure = ByteUnitMeasure.getMegaByteDimForStorage();
|
||||
private String unitMeasureLabel = ByteUnitMeasure.MB;
|
||||
private TextButton unitButton;
|
||||
|
||||
private ChartOptions options;
|
||||
|
||||
private StorageChartMeasure measure = StorageChartMeasure.DataVolume;
|
||||
private TextButton measureButton;
|
||||
|
||||
private VerticalLayoutContainer vert;
|
||||
private long unitMeasure = ByteUnitMeasure.getMegaByteDimForStorage();
|
||||
private String unitMeasureLabel = ByteUnitMeasure.MB;
|
||||
private TextButton unitButton;
|
||||
|
||||
public StorageChartTopPanel(AccountingStateData accountingStateData) {
|
||||
this.accountingStateData = accountingStateData;
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.client.maindata.charts.utils;
|
||||
|
||||
/**
|
||||
* Time Unit
|
||||
*
|
||||
*
|
||||
* @author Giancarlo Panichi email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class TimeUnitMeasure {
|
||||
public static final String HOURS = "Hours";
|
||||
public static final String MINUTES = "Minutes";
|
||||
public static final String SECONDS = "Seconds";
|
||||
public static final String MILLISECONDS = "Milliseconds";
|
||||
|
||||
public static final String H = "h";
|
||||
public static final String M = "m";
|
||||
public static final String S = "s";
|
||||
public static final String MS = "ms";
|
||||
|
||||
public static long getMilliseconds() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static long getSeconds() {
|
||||
return 1000;
|
||||
}
|
||||
|
||||
public static long getMinutes() {
|
||||
return 60000;
|
||||
}
|
||||
|
||||
public static long getHours() {
|
||||
return 3600000;
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -180,10 +180,10 @@ public class AccountingCallerTester implements AccountingCallerInterface {
|
|||
for (int i = 0; i < 30; i++) {
|
||||
SeriesServiceData data = new SeriesServiceData(
|
||||
new Date(),
|
||||
new Double(10 * Math.random()).longValue(),
|
||||
new Double(10 * Math.random()).longValue(),
|
||||
new Double(10 * Math.random()).longValue(),
|
||||
new Double(100 * Math.random()).longValue());
|
||||
new Double(50 * Math.random()).longValue(),
|
||||
new Double(10000 * Math.random()).longValue(),
|
||||
new Double(10000 * Math.random()).longValue(),
|
||||
new Double(10000 * Math.random()).longValue());
|
||||
seriesServiceData.add(data);
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue