Updated to support Operation Count as default in all charts

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/admin/accounting-manager@158705 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2017-11-20 11:40:59 +00:00
parent 51cf1628fc
commit faceb82a43
7 changed files with 358 additions and 612 deletions

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/accounting-manager-1.8.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<classpathentry kind="src" output="target/accounting-manager-1.9.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/accounting-manager-1.8.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
<classpathentry excluding="**" kind="src" output="target/accounting-manager-1.9.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
@ -45,5 +45,5 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/accounting-manager-1.8.0-SNAPSHOT/WEB-INF/classes"/>
<classpathentry kind="output" path="target/accounting-manager-1.9.0-SNAPSHOT/WEB-INF/classes"/>
</classpath>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="accounting-manager-1.8.0-SNAPSHOT">
<wb-module deploy-name="accounting-manager-1.9.0-SNAPSHOT">
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>

View File

@ -1,4 +1,8 @@
<ReleaseNotes>
<Changeset component="org.gcube.portlets.admin.accounting-manager.1-9-0"
date="2017-11-20">
<Change>Updated to support Operation Count as default in all charts</Change>
</Changeset>
<Changeset component="org.gcube.portlets.admin.accounting-manager.1-8-0"
date="2017-10-01">
<Change>Updated to new version of accounting client library</Change>

View File

@ -13,7 +13,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.gcube.portlets.admin</groupId>
<artifactId>accounting-manager</artifactId>
<version>1.8.0-SNAPSHOT</version>
<version>1.9.0-SNAPSHOT</version>
<packaging>war</packaging>

View File

@ -54,12 +54,11 @@ import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
*/
public class JobChartContextPanel extends SimpleContainer {
private static final int MAX_NUMBER_OF_CONTEXT = 20;
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 DateTimeFormat dtf = DateTimeFormat.getFormat(PredefinedFormat.YEAR_MONTH_DAY);
private EventBus eventBus;
private AccountingClientStateData accountingStateData;
@ -92,13 +91,12 @@ public class JobChartContextPanel extends SimpleContainer {
private ChartOptions options;
private JobChartMeasure measure = JobChartMeasure.Duration;
private JobChartMeasure measure = JobChartMeasure.OperationCount;
private TextButton measureButton;
private VerticalLayoutContainer vert;
public JobChartContextPanel(EventBus eventBus,
AccountingClientStateData accountingStateData) {
public JobChartContextPanel(EventBus eventBus, AccountingClientStateData accountingStateData) {
this.eventBus = eventBus;
this.accountingStateData = accountingStateData;
forceLayoutOnResize = true;
@ -110,8 +108,7 @@ public class JobChartContextPanel extends SimpleContainer {
ToolBar toolBar = new ToolBar();
toolBar.setSpacing(2);
// Download
final TextButton downloadButton = new TextButton(
DownloadConstants.DOWNLOAD,
final TextButton downloadButton = new TextButton(DownloadConstants.DOWNLOAD,
AccountingManagerResources.INSTANCE.accountingDownload24());
// downloadButton.setScale(ButtonScale.MEDIUM);
downloadButton.setIconAlign(IconAlign.RIGHT);
@ -119,18 +116,18 @@ public class JobChartContextPanel extends SimpleContainer {
downloadButton.setMenu(createDownloadMenu());
// Measure
measureButton = new TextButton(JobChartMeasure.Duration.getLabel(),
measureButton = new TextButton(JobChartMeasure.OperationCount.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 = new TextButton(TIME_UNIT, AccountingManagerResources.INSTANCE.accountingUnitms24());
unitButton.setIconAlign(IconAlign.RIGHT);
unitButton.setArrowAlign(ButtonArrowAlign.RIGHT);
unitButton.setMenu(createUnitMenu());
unitButton.setVisible(false);
toolBar.add(downloadButton, new BoxLayoutData(new Margins(0)));
toolBar.add(measureButton, new BoxLayoutData(new Margins(0)));
@ -145,8 +142,7 @@ public class JobChartContextPanel extends SimpleContainer {
//
vert = new VerticalLayoutContainer();
vert.add(toolBar, new VerticalLayoutData(1, -1, new Margins(0)));
vert.add(highchartsLayoutPanel, new VerticalLayoutData(1, 1,
new Margins(0)));
vert.add(highchartsLayoutPanel, new VerticalLayoutData(1, 1, new Margins(0)));
add(vert, new MarginData(0));
@ -265,14 +261,11 @@ public class JobChartContextPanel extends SimpleContainer {
// TODO
durationItem = new MenuItem(JobChartMeasure.Duration.getLabel());
durationItem.setHeight(30);
operationCountItem = new MenuItem(
JobChartMeasure.OperationCount.getLabel());
operationCountItem = new MenuItem(JobChartMeasure.OperationCount.getLabel());
operationCountItem.setHeight(30);
maxInvocationTimeItem = new MenuItem(
JobChartMeasure.MaxInvocationTime.getLabel());
maxInvocationTimeItem = new MenuItem(JobChartMeasure.MaxInvocationTime.getLabel());
maxInvocationTimeItem.setHeight(30);
minInvocationTimeItem = new MenuItem(
JobChartMeasure.MinInvocationTime.getLabel());
minInvocationTimeItem = new MenuItem(JobChartMeasure.MinInvocationTime.getLabel());
minInvocationTimeItem.setHeight(30);
durationItem.addSelectionHandler(new SelectionHandler<Item>() {
@ -301,8 +294,7 @@ public class JobChartContextPanel extends SimpleContainer {
@Override
public void onSelection(SelectionEvent<Item> event) {
measureButton.setText(JobChartMeasure.MaxInvocationTime
.getLabel());
measureButton.setText(JobChartMeasure.MaxInvocationTime.getLabel());
measure = JobChartMeasure.MaxInvocationTime;
unitButton.setVisible(true);
updateChart();
@ -313,8 +305,7 @@ public class JobChartContextPanel extends SimpleContainer {
@Override
public void onSelection(SelectionEvent<Item> event) {
measureButton.setText(JobChartMeasure.MinInvocationTime
.getLabel());
measureButton.setText(JobChartMeasure.MinInvocationTime.getLabel());
measure = JobChartMeasure.MinInvocationTime;
unitButton.setVisible(true);
updateChart();
@ -332,17 +323,13 @@ public class JobChartContextPanel extends SimpleContainer {
private Menu createUnitMenu() {
Menu menuUnit = new Menu();
msItem = new MenuItem(TimeUnitMeasure.MILLISECONDS,
AccountingManagerResources.INSTANCE.accountingUnitms24());
msItem = new MenuItem(TimeUnitMeasure.MILLISECONDS, AccountingManagerResources.INSTANCE.accountingUnitms24());
msItem.setHeight(30);
sItem = new MenuItem(TimeUnitMeasure.SECONDS,
AccountingManagerResources.INSTANCE.accountingUnits24());
sItem = new MenuItem(TimeUnitMeasure.SECONDS, AccountingManagerResources.INSTANCE.accountingUnits24());
sItem.setHeight(30);
mItem = new MenuItem(TimeUnitMeasure.MINUTES,
AccountingManagerResources.INSTANCE.accountingUnitm24());
mItem = new MenuItem(TimeUnitMeasure.MINUTES, AccountingManagerResources.INSTANCE.accountingUnitm24());
mItem.setHeight(30);
hItem = new MenuItem(TimeUnitMeasure.HOURS,
AccountingManagerResources.INSTANCE.accountingUnith24());
hItem = new MenuItem(TimeUnitMeasure.HOURS, AccountingManagerResources.INSTANCE.accountingUnith24());
hItem.setHeight(30);
msItem.addSelectionHandler(new SelectionHandler<Item>() {
@ -351,8 +338,7 @@ public class JobChartContextPanel extends SimpleContainer {
public void onSelection(SelectionEvent<Item> event) {
unitMeasure = TimeUnitMeasure.getMilliseconds();
unitMeasureLabel = TimeUnitMeasure.MS;
unitButton.setIcon(AccountingManagerResources.INSTANCE
.accountingUnitms24());
unitButton.setIcon(AccountingManagerResources.INSTANCE.accountingUnitms24());
updateChart();
}
});
@ -363,8 +349,7 @@ public class JobChartContextPanel extends SimpleContainer {
public void onSelection(SelectionEvent<Item> event) {
unitMeasure = TimeUnitMeasure.getSeconds();
unitMeasureLabel = TimeUnitMeasure.S;
unitButton.setIcon(AccountingManagerResources.INSTANCE
.accountingUnits24());
unitButton.setIcon(AccountingManagerResources.INSTANCE.accountingUnits24());
updateChart();
}
});
@ -375,8 +360,7 @@ public class JobChartContextPanel extends SimpleContainer {
public void onSelection(SelectionEvent<Item> event) {
unitMeasure = TimeUnitMeasure.getMinutes();
unitMeasureLabel = TimeUnitMeasure.M;
unitButton.setIcon(AccountingManagerResources.INSTANCE
.accountingUnitm24());
unitButton.setIcon(AccountingManagerResources.INSTANCE.accountingUnitm24());
updateChart();
}
});
@ -387,8 +371,7 @@ public class JobChartContextPanel extends SimpleContainer {
public void onSelection(SelectionEvent<Item> event) {
unitMeasure = TimeUnitMeasure.getHours();
unitMeasureLabel = TimeUnitMeasure.H;
unitButton.setIcon(AccountingManagerResources.INSTANCE
.accountingUnith24());
unitButton.setIcon(AccountingManagerResources.INSTANCE.accountingUnith24());
updateChart();
}
});
@ -402,20 +385,17 @@ public class JobChartContextPanel extends SimpleContainer {
}
private void onDownloadCSV() {
ExportRequestEvent event = new ExportRequestEvent(ExportType.CSV,
accountingStateData.getAccountingType());
ExportRequestEvent event = new ExportRequestEvent(ExportType.CSV, accountingStateData.getAccountingType());
eventBus.fireEvent(event);
}
private void onDownloadXML() {
ExportRequestEvent event = new ExportRequestEvent(ExportType.XML,
accountingStateData.getAccountingType());
ExportRequestEvent event = new ExportRequestEvent(ExportType.XML, accountingStateData.getAccountingType());
eventBus.fireEvent(event);
}
private void onDownloadJSON() {
ExportRequestEvent event = new ExportRequestEvent(ExportType.JSON,
accountingStateData.getAccountingType());
ExportRequestEvent event = new ExportRequestEvent(ExportType.JSON, accountingStateData.getAccountingType());
eventBus.fireEvent(event);
}
@ -472,15 +452,13 @@ public class JobChartContextPanel extends SimpleContainer {
}-*/;
private void createChart() {
SeriesJob seriesJob = (SeriesJob) accountingStateData
.getSeriesResponse();
SeriesJob seriesJob = (SeriesJob) accountingStateData.getSeriesResponse();
if (!(seriesJob.getSeriesJobDefinition() instanceof SeriesJobContext)) {
Log.debug("Invalid SeriesJobContext!");
return;
}
SeriesJobContext seriesJobContext = (SeriesJobContext) seriesJob
.getSeriesJobDefinition();
SeriesJobContext seriesJobContext = (SeriesJobContext) seriesJob.getSeriesJobDefinition();
HighchartsOptionFactory highchartsFactory = new JsoHighchartsOptionFactory();
@ -491,7 +469,8 @@ public class JobChartContextPanel extends SimpleContainer {
options.title().text("Accounting Job Context");
/*
* options.subtitle().text("Click and drag in the plot area to zoom in");
* options.subtitle().text("Click and drag in the plot area to zoom in"
* );
*/
ArrayString colors = options.colors();
@ -501,22 +480,19 @@ public class JobChartContextPanel extends SimpleContainer {
// yAxis
options.setFieldAsJsonObject("yAxis", retrieveYAxis(colors));
options.plotOptions().setFieldAsJsonObject(
"column",
"{ " + "\"stacking\": \"normal\"," + "\"dataLabels\": { "
+ " \"enabled\": \"true\","
options.plotOptions().setFieldAsJsonObject("column",
"{ " + "\"stacking\": \"normal\"," + "\"dataLabels\": { " + " \"enabled\": \"true\","
+ " \"color\": \"white\", " + " \"style\": {"
+ " \"textShadow\": \"0 0 3px black\"" + " }"
+ " }" + " }");
+ " \"textShadow\": \"0 0 3px black\"" + " }" + " }" + " }");
ArrayList<SeriesColumn> seriesColumn = new ArrayList<>();
/*if (seriesJobContext.getShowOthers()) {
createSeriesColumnShowOthers(seriesJobContext, highchartsFactory,
colors, seriesColumn);
} else {*/
createSeriesColumnSimple(seriesJobContext, highchartsFactory, colors,
seriesColumn);
/*}*/
/*
* if (seriesJobContext.getShowOthers()) {
* createSeriesColumnShowOthers(seriesJobContext, highchartsFactory,
* colors, seriesColumn); } else {
*/
createSeriesColumnSimple(seriesJobContext, highchartsFactory, colors, seriesColumn);
/* } */
for (SeriesColumn serie : seriesColumn) {
options.series().addToEnd(serie);
@ -529,34 +505,27 @@ public class JobChartContextPanel extends SimpleContainer {
}
private void createSeriesColumnShowOthers(SeriesJobContext seriesJobContext,
HighchartsOptionFactory highchartsFactory, ArrayString colors,
ArrayList<SeriesColumn> seriesColumn) {
HighchartsOptionFactory highchartsFactory, ArrayString colors, ArrayList<SeriesColumn> seriesColumn) {
Log.debug("Series ShowOthers");
if (accountingStateData.getSeriesRequest().getAccountingPeriod()
.getPeriod().compareTo(AccountingPeriodMode.DAILY) == 0
|| accountingStateData.getSeriesRequest().getAccountingPeriod()
.getPeriod().compareTo(AccountingPeriodMode.HOURLY) == 0
|| accountingStateData.getSeriesRequest().getAccountingPeriod()
.getPeriod().compareTo(AccountingPeriodMode.MINUTELY) == 0) {
if (accountingStateData.getSeriesRequest().getAccountingPeriod().getPeriod()
.compareTo(AccountingPeriodMode.DAILY) == 0
|| accountingStateData.getSeriesRequest().getAccountingPeriod().getPeriod()
.compareTo(AccountingPeriodMode.HOURLY) == 0
|| accountingStateData.getSeriesRequest().getAccountingPeriod().getPeriod()
.compareTo(AccountingPeriodMode.MINUTELY) == 0) {
double minRange = ChartTimeMeasure
.calculateMinRange(accountingStateData.getSeriesRequest()
.getAccountingPeriod());
.calculateMinRange(accountingStateData.getSeriesRequest().getAccountingPeriod());
double interval = ChartTimeMeasure
.calculateInterval(accountingStateData.getSeriesRequest()
.getAccountingPeriod());
.calculateInterval(accountingStateData.getSeriesRequest().getAccountingPeriod());
Date dateStart = dtf.parse(accountingStateData.getSeriesRequest()
.getAccountingPeriod().getStartDate());
Date dateStart = dtf.parse(accountingStateData.getSeriesRequest().getAccountingPeriod().getStartDate());
dateStart.setTime(dateStart.getTime()
+ ChartTimeMeasure.timeZoneOffset()
* ChartTimeMeasure.MINUTE);
dateStart.setTime(dateStart.getTime() + ChartTimeMeasure.timeZoneOffset() * ChartTimeMeasure.MINUTE);
Log.debug("BuildChart DateStart: "
+ DateTimeFormat.getFormat(PredefinedFormat.DATE_TIME_FULL)
.format(dateStart));
+ DateTimeFormat.getFormat(PredefinedFormat.DATE_TIME_FULL).format(dateStart));
// xAxis
options.xAxis().type("datetime");
@ -564,31 +533,25 @@ public class JobChartContextPanel extends SimpleContainer {
options.tooltip().xDateFormat("Selected Data");
int i = 0;
for (; i < seriesJobContext.getSeriesJobDataContextList().size()
&& i < MAX_NUMBER_OF_CONTEXT; i++) {
SeriesColumn seriesColumnData = highchartsFactory
.createSeriesColumn();
for (; i < seriesJobContext.getSeriesJobDataContextList().size() && i < MAX_NUMBER_OF_CONTEXT; i++) {
SeriesColumn seriesColumnData = highchartsFactory.createSeriesColumn();
seriesColumnData.name(seriesJobContext.getSeriesJobDataContextList()
.get(i).getContext());
seriesColumnData.name(seriesJobContext.getSeriesJobDataContextList().get(i).getContext());
seriesColumnData.color(colors.get(i));
seriesColumnData.type("column");
ArrayNumber data = seriesColumnData.dataAsArrayNumber();
for (SeriesJobData seriesJobData : seriesJobContext
.getSeriesJobDataContextList().get(i).getSeries()) {
for (SeriesJobData seriesJobData : seriesJobContext.getSeriesJobDataContextList().get(i).getSeries()) {
switch (measure) {
case Duration:
data.push(seriesJobData.getDuration() / unitMeasure);
break;
case MaxInvocationTime:
data.push(seriesJobData.getMaxInvocationTime()
/ unitMeasure);
data.push(seriesJobData.getMaxInvocationTime() / unitMeasure);
break;
case MinInvocationTime:
data.push(seriesJobData.getMinInvocationTime()
/ unitMeasure);
data.push(seriesJobData.getMinInvocationTime() / unitMeasure);
break;
case OperationCount:
data.push(seriesJobData.getOperationCount());
@ -601,77 +564,62 @@ public class JobChartContextPanel extends SimpleContainer {
}
seriesColumnData.pointInterval(interval).pointStart(
dateStart.getTime());
seriesColumnData.pointInterval(interval).pointStart(dateStart.getTime());
seriesColumn.add(seriesColumnData);
}
if (i < seriesJobContext.getSeriesJobDataContextList().size()) {
SeriesColumn seriesColumnData = highchartsFactory
.createSeriesColumn();
SeriesColumn seriesColumnData = highchartsFactory.createSeriesColumn();
seriesColumnData.name("Others");
seriesColumnData.color(colors.get(i));
seriesColumnData.type("column");
ArrayList<Long> othersData = new ArrayList<>();
for (int j = i; j < seriesJobContext.getSeriesJobDataContextList()
.size(); j++) {
for (int j = i; j < seriesJobContext.getSeriesJobDataContextList().size(); j++) {
Long value;
for (int k = 0; k < seriesJobContext.getSeriesJobDataContextList()
.get(j).getSeries().size(); k++) {
SeriesJobData seriesJobData = seriesJobContext
.getSeriesJobDataContextList().get(j).getSeries()
for (int k = 0; k < seriesJobContext.getSeriesJobDataContextList().get(j).getSeries().size(); k++) {
SeriesJobData seriesJobData = seriesJobContext.getSeriesJobDataContextList().get(j).getSeries()
.get(k);
if (j == i) {
switch (measure) {
case Duration:
othersData.add(seriesJobData.getDuration()
/ unitMeasure);
othersData.add(seriesJobData.getDuration() / unitMeasure);
break;
case MaxInvocationTime:
othersData.add(seriesJobData
.getMaxInvocationTime() / unitMeasure);
othersData.add(seriesJobData.getMaxInvocationTime() / unitMeasure);
break;
case MinInvocationTime:
othersData.add(seriesJobData
.getMinInvocationTime() / unitMeasure);
othersData.add(seriesJobData.getMinInvocationTime() / unitMeasure);
break;
case OperationCount:
othersData.add(seriesJobData
.getOperationCount());
othersData.add(seriesJobData.getOperationCount());
break;
default:
othersData.add(seriesJobData.getDuration()
/ unitMeasure);
othersData.add(seriesJobData.getDuration() / unitMeasure);
break;
}
} else {
switch (measure) {
case Duration:
value = (seriesJobData.getDuration() / unitMeasure)
+ othersData.get(k);
value = (seriesJobData.getDuration() / unitMeasure) + othersData.get(k);
othersData.set(k, value);
break;
case MaxInvocationTime:
value = (seriesJobData.getMaxInvocationTime() / unitMeasure)
+ othersData.get(k);
value = (seriesJobData.getMaxInvocationTime() / unitMeasure) + othersData.get(k);
othersData.set(k, value);
break;
case MinInvocationTime:
value = (seriesJobData.getMinInvocationTime() / unitMeasure)
+ othersData.get(k);
value = (seriesJobData.getMinInvocationTime() / unitMeasure) + othersData.get(k);
othersData.set(k, value);
break;
case OperationCount:
value = seriesJobData.getOperationCount()
+ othersData.get(k);
value = seriesJobData.getOperationCount() + othersData.get(k);
othersData.set(k, value);
break;
default:
value = (seriesJobData.getDuration() / unitMeasure)
+ othersData.get(k);
value = (seriesJobData.getDuration() / unitMeasure) + othersData.get(k);
othersData.set(k, value);
break;
@ -688,8 +636,7 @@ public class JobChartContextPanel extends SimpleContainer {
data.push(value);
}
seriesColumnData.pointInterval(interval).pointStart(
dateStart.getTime());
seriesColumnData.pointInterval(interval).pointStart(dateStart.getTime());
seriesColumn.add(seriesColumnData);
}
@ -697,16 +644,15 @@ public class JobChartContextPanel extends SimpleContainer {
// xAxis
options.xAxis().type("datetime");
if (accountingStateData.getSeriesRequest().getAccountingPeriod()
.getPeriod().compareTo(AccountingPeriodMode.MONTHLY) == 0) {
//options.tooltip().xDateFormat("%b, %Y");
if (accountingStateData.getSeriesRequest().getAccountingPeriod().getPeriod()
.compareTo(AccountingPeriodMode.MONTHLY) == 0) {
// options.tooltip().xDateFormat("%b, %Y");
options.tooltip().xDateFormat("Selected Data");
} else {
if (accountingStateData.getSeriesRequest()
.getAccountingPeriod().getPeriod()
if (accountingStateData.getSeriesRequest().getAccountingPeriod().getPeriod()
.compareTo(AccountingPeriodMode.YEARLY) == 0) {
//options.tooltip().xDateFormat("%Y");
// options.tooltip().xDateFormat("%Y");
options.tooltip().xDateFormat("Selected Data");
} else {
@ -716,20 +662,16 @@ public class JobChartContextPanel extends SimpleContainer {
}
int i = 0;
for (; i < seriesJobContext.getSeriesJobDataContextList().size()
&& i < MAX_NUMBER_OF_CONTEXT; i++) {
SeriesColumn seriesColumnData = highchartsFactory
.createSeriesColumn();
for (; i < seriesJobContext.getSeriesJobDataContextList().size() && i < MAX_NUMBER_OF_CONTEXT; i++) {
SeriesColumn seriesColumnData = highchartsFactory.createSeriesColumn();
seriesColumnData.name(seriesJobContext.getSeriesJobDataContextList()
.get(i).getContext());
seriesColumnData.name(seriesJobContext.getSeriesJobDataContextList().get(i).getContext());
seriesColumnData.color(colors.get(i));
seriesColumnData.type("column");
Array<Data> arrayData = seriesColumnData.dataAsArrayObject();
for (SeriesJobData seriesJobData : seriesJobContext
.getSeriesJobDataContextList().get(i).getSeries()) {
for (SeriesJobData seriesJobData : seriesJobContext.getSeriesJobDataContextList().get(i).getSeries()) {
long dateFrom1970 = seriesJobData.getDate().getTime();
Log.debug("SeriersJobData: " + seriesJobData.getDate());
@ -745,14 +687,12 @@ public class JobChartContextPanel extends SimpleContainer {
break;
case MaxInvocationTime:
data.x(dateFrom1970);
data.y(seriesJobData.getMaxInvocationTime()
/ unitMeasure);
data.y(seriesJobData.getMaxInvocationTime() / unitMeasure);
arrayData.addToEnd(data);
break;
case MinInvocationTime:
data.x(dateFrom1970);
data.y(seriesJobData.getMinInvocationTime()
/ unitMeasure);
data.y(seriesJobData.getMinInvocationTime() / unitMeasure);
arrayData.addToEnd(data);
break;
case OperationCount:
@ -775,94 +715,73 @@ public class JobChartContextPanel extends SimpleContainer {
}
if (i < seriesJobContext.getSeriesJobDataContextList().size()) {
SeriesColumn seriesColumnData = highchartsFactory
.createSeriesColumn();
SeriesColumn seriesColumnData = highchartsFactory.createSeriesColumn();
seriesColumnData.name("Others");
seriesColumnData.color(colors.get(i));
seriesColumnData.type("column");
ArrayList<ChartDateTimeData> othersData = new ArrayList<>();
for (int j = i; j < seriesJobContext.getSeriesJobDataContextList()
.size(); j++) {
for (int j = i; j < seriesJobContext.getSeriesJobDataContextList().size(); j++) {
ChartDateTimeData chartDateTimeData;
for (int k = 0; k < seriesJobContext.getSeriesJobDataContextList()
.get(j).getSeries().size(); k++) {
SeriesJobData seriesJobData = seriesJobContext
.getSeriesJobDataContextList().get(j).getSeries()
for (int k = 0; k < seriesJobContext.getSeriesJobDataContextList().get(j).getSeries().size(); k++) {
SeriesJobData seriesJobData = seriesJobContext.getSeriesJobDataContextList().get(j).getSeries()
.get(k);
if (j == i) {
switch (measure) {
case Duration:
chartDateTimeData = new ChartDateTimeData(
seriesJobData.getDate(),
seriesJobData.getDuration()
/ unitMeasure);
chartDateTimeData = new ChartDateTimeData(seriesJobData.getDate(),
seriesJobData.getDuration() / unitMeasure);
othersData.add(chartDateTimeData);
break;
case MaxInvocationTime:
chartDateTimeData = new ChartDateTimeData(
seriesJobData.getDate(),
seriesJobData.getMaxInvocationTime()
/ unitMeasure);
chartDateTimeData = new ChartDateTimeData(seriesJobData.getDate(),
seriesJobData.getMaxInvocationTime() / unitMeasure);
othersData.add(chartDateTimeData);
break;
case MinInvocationTime:
chartDateTimeData = new ChartDateTimeData(
seriesJobData.getDate(),
seriesJobData.getMinInvocationTime()
/ unitMeasure);
chartDateTimeData = new ChartDateTimeData(seriesJobData.getDate(),
seriesJobData.getMinInvocationTime() / unitMeasure);
othersData.add(chartDateTimeData);
break;
case OperationCount:
chartDateTimeData = new ChartDateTimeData(
seriesJobData.getDate(),
chartDateTimeData = new ChartDateTimeData(seriesJobData.getDate(),
seriesJobData.getOperationCount());
othersData.add(chartDateTimeData);
break;
default:
chartDateTimeData = new ChartDateTimeData(
seriesJobData.getDate(),
seriesJobData.getDuration()
/ unitMeasure);
chartDateTimeData = new ChartDateTimeData(seriesJobData.getDate(),
seriesJobData.getDuration() / unitMeasure);
othersData.add(chartDateTimeData);
break;
}
} else {
switch (measure) {
case Duration:
chartDateTimeData = new ChartDateTimeData(
seriesJobData.getDate(),
(seriesJobData.getDuration() / unitMeasure)
+ othersData.get(k).getValue());
chartDateTimeData = new ChartDateTimeData(seriesJobData.getDate(),
(seriesJobData.getDuration() / unitMeasure) + othersData.get(k).getValue());
othersData.set(k, chartDateTimeData);
break;
case MaxInvocationTime:
chartDateTimeData = new ChartDateTimeData(
seriesJobData.getDate(),
chartDateTimeData = new ChartDateTimeData(seriesJobData.getDate(),
(seriesJobData.getMaxInvocationTime() / unitMeasure)
+ othersData.get(k).getValue());
othersData.set(k, chartDateTimeData);
break;
case MinInvocationTime:
chartDateTimeData = new ChartDateTimeData(
seriesJobData.getDate(),
chartDateTimeData = new ChartDateTimeData(seriesJobData.getDate(),
(seriesJobData.getMinInvocationTime() / unitMeasure)
+ othersData.get(k).getValue());
othersData.set(k, chartDateTimeData);
break;
case OperationCount:
chartDateTimeData = new ChartDateTimeData(
seriesJobData.getDate(),
seriesJobData.getOperationCount()
+ othersData.get(k).getValue());
chartDateTimeData = new ChartDateTimeData(seriesJobData.getDate(),
seriesJobData.getOperationCount() + othersData.get(k).getValue());
othersData.set(k, chartDateTimeData);
break;
default:
chartDateTimeData = new ChartDateTimeData(
seriesJobData.getDate(),
(seriesJobData.getDuration() / unitMeasure)
+ othersData.get(k).getValue());
chartDateTimeData = new ChartDateTimeData(seriesJobData.getDate(),
(seriesJobData.getDuration() / unitMeasure) + othersData.get(k).getValue());
othersData.set(k, chartDateTimeData);
break;
@ -878,8 +797,7 @@ public class JobChartContextPanel extends SimpleContainer {
for (ChartDateTimeData chartDateTimeData : othersData) {
long dateFrom1970 = chartDateTimeData.getDate().getTime();
Log.debug("SeriersOthersData: "
+ chartDateTimeData.getDate());
Log.debug("SeriersOthersData: " + chartDateTimeData.getDate());
Log.debug("SeriersOthersData: " + dateFrom1970);
Data data = highchartsFactory.createSeriesColumnData();
@ -896,65 +814,53 @@ public class JobChartContextPanel extends SimpleContainer {
}
}
private void createSeriesColumnSimple(SeriesJobContext seriesJobContext,
HighchartsOptionFactory highchartsFactory, ArrayString colors,
ArrayList<SeriesColumn> seriesColumn) {
private void createSeriesColumnSimple(SeriesJobContext seriesJobContext, HighchartsOptionFactory highchartsFactory,
ArrayString colors, ArrayList<SeriesColumn> seriesColumn) {
Log.debug("Series Simple");
if (accountingStateData.getSeriesRequest().getAccountingPeriod()
.getPeriod().compareTo(AccountingPeriodMode.DAILY) == 0
|| accountingStateData.getSeriesRequest().getAccountingPeriod()
.getPeriod().compareTo(AccountingPeriodMode.HOURLY) == 0
|| accountingStateData.getSeriesRequest().getAccountingPeriod()
.getPeriod().compareTo(AccountingPeriodMode.MINUTELY) == 0) {
if (accountingStateData.getSeriesRequest().getAccountingPeriod().getPeriod()
.compareTo(AccountingPeriodMode.DAILY) == 0
|| accountingStateData.getSeriesRequest().getAccountingPeriod().getPeriod()
.compareTo(AccountingPeriodMode.HOURLY) == 0
|| accountingStateData.getSeriesRequest().getAccountingPeriod().getPeriod()
.compareTo(AccountingPeriodMode.MINUTELY) == 0) {
double minRange = ChartTimeMeasure
.calculateMinRange(accountingStateData.getSeriesRequest()
.getAccountingPeriod());
.calculateMinRange(accountingStateData.getSeriesRequest().getAccountingPeriod());
double interval = ChartTimeMeasure
.calculateInterval(accountingStateData.getSeriesRequest()
.getAccountingPeriod());
.calculateInterval(accountingStateData.getSeriesRequest().getAccountingPeriod());
Date dateStart = dtf.parse(accountingStateData.getSeriesRequest()
.getAccountingPeriod().getStartDate());
Date dateStart = dtf.parse(accountingStateData.getSeriesRequest().getAccountingPeriod().getStartDate());
dateStart.setTime(dateStart.getTime()
+ ChartTimeMeasure.timeZoneOffset()
* ChartTimeMeasure.MINUTE);
dateStart.setTime(dateStart.getTime() + ChartTimeMeasure.timeZoneOffset() * ChartTimeMeasure.MINUTE);
Log.debug("BuildChart DateStart: "
+ DateTimeFormat.getFormat(PredefinedFormat.DATE_TIME_FULL)
.format(dateStart));
+ DateTimeFormat.getFormat(PredefinedFormat.DATE_TIME_FULL).format(dateStart));
// xAxis
options.xAxis().type("datetime");
options.xAxis().minRange(minRange);
options.tooltip().xDateFormat("Selected Data");
for (int i = 0; i < seriesJobContext.getSeriesJobDataContextList().size(); i++) {
SeriesColumn seriesColumnData = highchartsFactory
.createSeriesColumn();
seriesColumnData.name(seriesJobContext.getSeriesJobDataContextList()
.get(i).getContext());
for (int i = 0; i < seriesJobContext.getSeriesJobDataContextList().size(); i++) {
SeriesColumn seriesColumnData = highchartsFactory.createSeriesColumn();
seriesColumnData.name(seriesJobContext.getSeriesJobDataContextList().get(i).getContext());
seriesColumnData.color(colors.get(i));
seriesColumnData.type("column");
ArrayNumber data = seriesColumnData.dataAsArrayNumber();
for (SeriesJobData seriesJobData : seriesJobContext
.getSeriesJobDataContextList().get(i).getSeries()) {
for (SeriesJobData seriesJobData : seriesJobContext.getSeriesJobDataContextList().get(i).getSeries()) {
switch (measure) {
case Duration:
data.push(seriesJobData.getDuration() / unitMeasure);
break;
case MaxInvocationTime:
data.push(seriesJobData.getMaxInvocationTime()
/ unitMeasure);
data.push(seriesJobData.getMaxInvocationTime() / unitMeasure);
break;
case MinInvocationTime:
data.push(seriesJobData.getMinInvocationTime()
/ unitMeasure);
data.push(seriesJobData.getMinInvocationTime() / unitMeasure);
break;
case OperationCount:
data.push(seriesJobData.getOperationCount());
@ -967,8 +873,7 @@ public class JobChartContextPanel extends SimpleContainer {
}
seriesColumnData.pointInterval(interval).pointStart(
dateStart.getTime());
seriesColumnData.pointInterval(interval).pointStart(dateStart.getTime());
seriesColumn.add(seriesColumnData);
}
@ -976,16 +881,15 @@ public class JobChartContextPanel extends SimpleContainer {
// xAxis
options.xAxis().type("datetime");
if (accountingStateData.getSeriesRequest().getAccountingPeriod()
.getPeriod().compareTo(AccountingPeriodMode.MONTHLY) == 0) {
//options.tooltip().xDateFormat("%b, %Y");
if (accountingStateData.getSeriesRequest().getAccountingPeriod().getPeriod()
.compareTo(AccountingPeriodMode.MONTHLY) == 0) {
// options.tooltip().xDateFormat("%b, %Y");
options.tooltip().xDateFormat("Selected Data");
} else {
if (accountingStateData.getSeriesRequest()
.getAccountingPeriod().getPeriod()
if (accountingStateData.getSeriesRequest().getAccountingPeriod().getPeriod()
.compareTo(AccountingPeriodMode.YEARLY) == 0) {
//options.tooltip().xDateFormat("%Y");
// options.tooltip().xDateFormat("%Y");
options.tooltip().xDateFormat("Selected Data");
} else {
@ -995,18 +899,15 @@ public class JobChartContextPanel extends SimpleContainer {
}
for (int i = 0; i < seriesJobContext.getSeriesJobDataContextList().size(); i++) {
SeriesColumn seriesColumnData = highchartsFactory
.createSeriesColumn();
SeriesColumn seriesColumnData = highchartsFactory.createSeriesColumn();
seriesColumnData.name(seriesJobContext.getSeriesJobDataContextList()
.get(i).getContext());
seriesColumnData.name(seriesJobContext.getSeriesJobDataContextList().get(i).getContext());
seriesColumnData.color(colors.get(i));
seriesColumnData.type("column");
Array<Data> arrayData = seriesColumnData.dataAsArrayObject();
for (SeriesJobData seriesJobData : seriesJobContext
.getSeriesJobDataContextList().get(i).getSeries()) {
for (SeriesJobData seriesJobData : seriesJobContext.getSeriesJobDataContextList().get(i).getSeries()) {
long dateFrom1970 = seriesJobData.getDate().getTime();
Log.debug("SeriersJobData: " + seriesJobData.getDate());
@ -1022,14 +923,12 @@ public class JobChartContextPanel extends SimpleContainer {
break;
case MaxInvocationTime:
data.x(dateFrom1970);
data.y(seriesJobData.getMaxInvocationTime()
/ unitMeasure);
data.y(seriesJobData.getMaxInvocationTime() / unitMeasure);
arrayData.addToEnd(data);
break;
case MinInvocationTime:
data.x(dateFrom1970);
data.y(seriesJobData.getMinInvocationTime()
/ unitMeasure);
data.y(seriesJobData.getMinInvocationTime() / unitMeasure);
arrayData.addToEnd(data);
break;
case OperationCount:
@ -1057,67 +956,44 @@ public class JobChartContextPanel extends SimpleContainer {
private String retrieveYAxis(ArrayString colors) {
switch (measure) {
case Duration:
return "[{" + " \"id\": \"" + JobChartMeasure.Duration.name()
+ "\"," + " \"labels\": {" + " \"format\": \"{value} "
+ unitMeasureLabel + "\"," + " \"style\": {"
+ " \"color\": \"" + colors.get(1) + "\"" + " }"
+ " }," + " \"stackLabels\": {" + " \"enabled\": \"true\","
+ " \"style\": {" + " \"fontWeight\": \"bold\","
+ " \"color\": \"gray\"" + " } " + " },"
+ " \"title\": { " + " \"text\": \""
+ JobChartMeasure.Duration.getLabel() + "\","
+ " \"style\": {" + " \"color\": \""
return "[{" + " \"id\": \"" + JobChartMeasure.Duration.name() + "\"," + " \"labels\": {"
+ " \"format\": \"{value} " + unitMeasureLabel + "\"," + " \"style\": {"
+ " \"color\": \"" + colors.get(1) + "\"" + " }" + " }," + " \"stackLabels\": {"
+ " \"enabled\": \"true\"," + " \"style\": {" + " \"fontWeight\": \"bold\","
+ " \"color\": \"gray\"" + " } " + " }," + " \"title\": { " + " \"text\": \""
+ JobChartMeasure.Duration.getLabel() + "\"," + " \"style\": {" + " \"color\": \""
+ colors.get(1) + "\"" + " }" + " }" + "}]";
case MaxInvocationTime:
return "[{" + " \"id\": \""
+ JobChartMeasure.MaxInvocationTime.name() + "\","
+ " \"labels\": {" + " \"format\": \"{value} "
+ unitMeasureLabel + "\"," + " \"style\": {"
+ " \"color\": \"" + colors.get(1) + "\"" + " }"
+ " }," + " \"stackLabels\": {" + " \"enabled\": \"true\","
+ " \"style\": {" + " \"fontWeight\": \"bold\","
+ " \"color\": \"gray\"" + " } " + " },"
+ " \"title\": { " + " \"text\": \""
+ JobChartMeasure.MaxInvocationTime.getLabel() + "\","
+ " \"style\": {" + " \"color\": \""
return "[{" + " \"id\": \"" + JobChartMeasure.MaxInvocationTime.name() + "\"," + " \"labels\": {"
+ " \"format\": \"{value} " + unitMeasureLabel + "\"," + " \"style\": {"
+ " \"color\": \"" + colors.get(1) + "\"" + " }" + " }," + " \"stackLabels\": {"
+ " \"enabled\": \"true\"," + " \"style\": {" + " \"fontWeight\": \"bold\","
+ " \"color\": \"gray\"" + " } " + " }," + " \"title\": { " + " \"text\": \""
+ JobChartMeasure.MaxInvocationTime.getLabel() + "\"," + " \"style\": {" + " \"color\": \""
+ colors.get(1) + "\"" + " }" + " }" + "}]";
case MinInvocationTime:
return "[{" + " \"id\": \""
+ JobChartMeasure.MinInvocationTime.name() + "\","
+ " \"labels\": {" + " \"format\": \"{value} "
+ unitMeasureLabel + "\"," + " \"style\": {"
+ " \"color\": \"" + colors.get(1) + "\"" + " }"
+ " }," + " \"stackLabels\": {" + " \"enabled\": \"true\","
+ " \"style\": {" + " \"fontWeight\": \"bold\","
+ " \"color\": \"gray\"" + " } " + " },"
+ " \"title\": { " + " \"text\": \""
+ JobChartMeasure.MinInvocationTime.getLabel() + "\","
+ " \"style\": {" + " \"color\": \""
return "[{" + " \"id\": \"" + JobChartMeasure.MinInvocationTime.name() + "\"," + " \"labels\": {"
+ " \"format\": \"{value} " + unitMeasureLabel + "\"," + " \"style\": {"
+ " \"color\": \"" + colors.get(1) + "\"" + " }" + " }," + " \"stackLabels\": {"
+ " \"enabled\": \"true\"," + " \"style\": {" + " \"fontWeight\": \"bold\","
+ " \"color\": \"gray\"" + " } " + " }," + " \"title\": { " + " \"text\": \""
+ JobChartMeasure.MinInvocationTime.getLabel() + "\"," + " \"style\": {" + " \"color\": \""
+ colors.get(1) + "\"" + " }" + " }" + "}]";
case OperationCount:
return "[{" + " \"id\": \"" + JobChartMeasure.OperationCount.name()
+ "\"," + " \"labels\": { "
+ " \"format\": \"{value}\"," + " \"style\": { "
+ " \"color\": \"" + colors.get(1) + "\"" + " }"
+ " }," + " \"stackLabels\": {" + " \"enabled\": \"true\","
+ " \"style\": {" + " \"fontWeight\": \"bold\","
+ " \"color\": \"gray\"" + " } " + " },"
+ " \"title\": { " + " \"text\": \""
+ JobChartMeasure.OperationCount.getLabel() + "\","
+ " \"style\": {" + " \"color\": \""
+ colors.get(1) + "\"" + " }" + " }" + "}]";
return "[{" + " \"id\": \"" + JobChartMeasure.OperationCount.name() + "\"," + " \"labels\": { "
+ " \"format\": \"{value}\"," + " \"style\": { " + " \"color\": \"" + colors.get(1)
+ "\"" + " }" + " }," + " \"stackLabels\": {" + " \"enabled\": \"true\"," + " \"style\": {"
+ " \"fontWeight\": \"bold\"," + " \"color\": \"gray\"" + " } " + " },"
+ " \"title\": { " + " \"text\": \"" + JobChartMeasure.OperationCount.getLabel() + "\","
+ " \"style\": {" + " \"color\": \"" + colors.get(1) + "\"" + " }" + " }" + "}]";
default:
return "[{" + " \"id\": \"" + JobChartMeasure.Duration.name()
+ "\"," + " \"labels\": {" + " \"format\": \"{value} "
+ unitMeasureLabel + "\"," + " \"style\": {"
+ " \"color\": \"" + colors.get(1) + "\"" + " }"
+ " }," + " \"stackLabels\": {" + " \"enabled\": \"true\","
+ " \"style\": {" + " \"fontWeight\": \"bold\","
+ " \"color\": \"gray\"" + " } " + " },"
+ " \"title\": { " + " \"text\": \""
+ JobChartMeasure.Duration.getLabel() + "\","
+ " \"style\": {" + " \"color\": \""
return "[{" + " \"id\": \"" + JobChartMeasure.Duration.name() + "\"," + " \"labels\": {"
+ " \"format\": \"{value} " + unitMeasureLabel + "\"," + " \"style\": {"
+ " \"color\": \"" + colors.get(1) + "\"" + " }" + " }," + " \"stackLabels\": {"
+ " \"enabled\": \"true\"," + " \"style\": {" + " \"fontWeight\": \"bold\","
+ " \"color\": \"gray\"" + " } " + " }," + " \"title\": { " + " \"text\": \""
+ JobChartMeasure.Duration.getLabel() + "\"," + " \"style\": {" + " \"color\": \""
+ colors.get(1) + "\"" + " }" + " }" + "}]";
}

View File

@ -91,7 +91,7 @@ public class JobChartTopPanel extends SimpleContainer {
private ChartOptions options;
private JobChartMeasure measure = JobChartMeasure.Duration;
private JobChartMeasure measure = JobChartMeasure.OperationCount;
private TextButton measureButton;
private VerticalLayoutContainer vert;
@ -118,7 +118,7 @@ public class JobChartTopPanel extends SimpleContainer {
downloadButton.setMenu(createDownloadMenu());
// Measure
measureButton = new TextButton(JobChartMeasure.Duration.getLabel(),
measureButton = new TextButton(JobChartMeasure.OperationCount.getLabel(),
AccountingManagerResources.INSTANCE.accountingByte24());
measureButton.setIconAlign(IconAlign.RIGHT);
measureButton.setArrowAlign(ButtonArrowAlign.RIGHT);
@ -130,6 +130,7 @@ public class JobChartTopPanel extends SimpleContainer {
unitButton.setIconAlign(IconAlign.RIGHT);
unitButton.setArrowAlign(ButtonArrowAlign.RIGHT);
unitButton.setMenu(createUnitMenu());
unitButton.setVisible(false);
toolBar.add(downloadButton, new BoxLayoutData(new Margins(0)));
toolBar.add(measureButton, new BoxLayoutData(new Margins(0)));

View File

@ -54,12 +54,11 @@ import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
*/
public class ServiceChartContextPanel extends SimpleContainer {
private static final int MAX_NUMBER_OF_CONTEXT = 20;
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 DateTimeFormat dtf = DateTimeFormat.getFormat(PredefinedFormat.YEAR_MONTH_DAY);
private EventBus eventBus;
private AccountingClientStateData accountingStateData;
@ -97,8 +96,7 @@ public class ServiceChartContextPanel extends SimpleContainer {
private VerticalLayoutContainer vert;
public ServiceChartContextPanel(EventBus eventBus,
AccountingClientStateData accountingStateData) {
public ServiceChartContextPanel(EventBus eventBus, AccountingClientStateData accountingStateData) {
this.eventBus = eventBus;
this.accountingStateData = accountingStateData;
forceLayoutOnResize = true;
@ -110,8 +108,7 @@ public class ServiceChartContextPanel extends SimpleContainer {
ToolBar toolBar = new ToolBar();
toolBar.setSpacing(2);
// Download
final TextButton downloadButton = new TextButton(
DownloadConstants.DOWNLOAD,
final TextButton downloadButton = new TextButton(DownloadConstants.DOWNLOAD,
AccountingManagerResources.INSTANCE.accountingDownload24());
// downloadButton.setScale(ButtonScale.MEDIUM);
downloadButton.setIconAlign(IconAlign.RIGHT);
@ -119,16 +116,14 @@ public class ServiceChartContextPanel extends SimpleContainer {
downloadButton.setMenu(createDownloadMenu());
// Measure
measureButton = new TextButton(
ServiceChartMeasure.OperationCount.getLabel(),
measureButton = new TextButton(ServiceChartMeasure.OperationCount.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 = new TextButton(TIME_UNIT, AccountingManagerResources.INSTANCE.accountingUnitms24());
unitButton.setIconAlign(IconAlign.RIGHT);
unitButton.setArrowAlign(ButtonArrowAlign.RIGHT);
unitButton.setMenu(createUnitMenu());
@ -147,8 +142,7 @@ public class ServiceChartContextPanel extends SimpleContainer {
//
vert = new VerticalLayoutContainer();
vert.add(toolBar, new VerticalLayoutData(1, -1, new Margins(0)));
vert.add(highchartsLayoutPanel, new VerticalLayoutData(1, 1,
new Margins(0)));
vert.add(highchartsLayoutPanel, new VerticalLayoutData(1, 1, new Margins(0)));
add(vert, new MarginData(0));
@ -267,14 +261,11 @@ public class ServiceChartContextPanel extends SimpleContainer {
// TODO
durationItem = new MenuItem(ServiceChartMeasure.Duration.getLabel());
durationItem.setHeight(30);
operationCountItem = new MenuItem(
ServiceChartMeasure.OperationCount.getLabel());
operationCountItem = new MenuItem(ServiceChartMeasure.OperationCount.getLabel());
operationCountItem.setHeight(30);
maxInvocationTimeItem = new MenuItem(
ServiceChartMeasure.MaxInvocationTime.getLabel());
maxInvocationTimeItem = new MenuItem(ServiceChartMeasure.MaxInvocationTime.getLabel());
maxInvocationTimeItem.setHeight(30);
minInvocationTimeItem = new MenuItem(
ServiceChartMeasure.MinInvocationTime.getLabel());
minInvocationTimeItem = new MenuItem(ServiceChartMeasure.MinInvocationTime.getLabel());
minInvocationTimeItem.setHeight(30);
durationItem.addSelectionHandler(new SelectionHandler<Item>() {
@ -292,8 +283,7 @@ public class ServiceChartContextPanel extends SimpleContainer {
@Override
public void onSelection(SelectionEvent<Item> event) {
measureButton.setText(ServiceChartMeasure.OperationCount
.getLabel());
measureButton.setText(ServiceChartMeasure.OperationCount.getLabel());
measure = ServiceChartMeasure.OperationCount;
unitButton.setVisible(false);
updateChart();
@ -304,8 +294,7 @@ public class ServiceChartContextPanel extends SimpleContainer {
@Override
public void onSelection(SelectionEvent<Item> event) {
measureButton.setText(ServiceChartMeasure.MaxInvocationTime
.getLabel());
measureButton.setText(ServiceChartMeasure.MaxInvocationTime.getLabel());
measure = ServiceChartMeasure.MaxInvocationTime;
unitButton.setVisible(true);
updateChart();
@ -316,8 +305,7 @@ public class ServiceChartContextPanel extends SimpleContainer {
@Override
public void onSelection(SelectionEvent<Item> event) {
measureButton.setText(ServiceChartMeasure.MinInvocationTime
.getLabel());
measureButton.setText(ServiceChartMeasure.MinInvocationTime.getLabel());
measure = ServiceChartMeasure.MinInvocationTime;
unitButton.setVisible(true);
updateChart();
@ -335,17 +323,13 @@ public class ServiceChartContextPanel extends SimpleContainer {
private Menu createUnitMenu() {
Menu menuUnit = new Menu();
msItem = new MenuItem(TimeUnitMeasure.MILLISECONDS,
AccountingManagerResources.INSTANCE.accountingUnitms24());
msItem = new MenuItem(TimeUnitMeasure.MILLISECONDS, AccountingManagerResources.INSTANCE.accountingUnitms24());
msItem.setHeight(30);
sItem = new MenuItem(TimeUnitMeasure.SECONDS,
AccountingManagerResources.INSTANCE.accountingUnits24());
sItem = new MenuItem(TimeUnitMeasure.SECONDS, AccountingManagerResources.INSTANCE.accountingUnits24());
sItem.setHeight(30);
mItem = new MenuItem(TimeUnitMeasure.MINUTES,
AccountingManagerResources.INSTANCE.accountingUnitm24());
mItem = new MenuItem(TimeUnitMeasure.MINUTES, AccountingManagerResources.INSTANCE.accountingUnitm24());
mItem.setHeight(30);
hItem = new MenuItem(TimeUnitMeasure.HOURS,
AccountingManagerResources.INSTANCE.accountingUnith24());
hItem = new MenuItem(TimeUnitMeasure.HOURS, AccountingManagerResources.INSTANCE.accountingUnith24());
hItem.setHeight(30);
msItem.addSelectionHandler(new SelectionHandler<Item>() {
@ -354,8 +338,7 @@ public class ServiceChartContextPanel extends SimpleContainer {
public void onSelection(SelectionEvent<Item> event) {
unitMeasure = TimeUnitMeasure.getMilliseconds();
unitMeasureLabel = TimeUnitMeasure.MS;
unitButton.setIcon(AccountingManagerResources.INSTANCE
.accountingUnitms24());
unitButton.setIcon(AccountingManagerResources.INSTANCE.accountingUnitms24());
updateChart();
}
});
@ -366,8 +349,7 @@ public class ServiceChartContextPanel extends SimpleContainer {
public void onSelection(SelectionEvent<Item> event) {
unitMeasure = TimeUnitMeasure.getSeconds();
unitMeasureLabel = TimeUnitMeasure.S;
unitButton.setIcon(AccountingManagerResources.INSTANCE
.accountingUnits24());
unitButton.setIcon(AccountingManagerResources.INSTANCE.accountingUnits24());
updateChart();
}
});
@ -378,8 +360,7 @@ public class ServiceChartContextPanel extends SimpleContainer {
public void onSelection(SelectionEvent<Item> event) {
unitMeasure = TimeUnitMeasure.getMinutes();
unitMeasureLabel = TimeUnitMeasure.M;
unitButton.setIcon(AccountingManagerResources.INSTANCE
.accountingUnitm24());
unitButton.setIcon(AccountingManagerResources.INSTANCE.accountingUnitm24());
updateChart();
}
});
@ -390,8 +371,7 @@ public class ServiceChartContextPanel extends SimpleContainer {
public void onSelection(SelectionEvent<Item> event) {
unitMeasure = TimeUnitMeasure.getHours();
unitMeasureLabel = TimeUnitMeasure.H;
unitButton.setIcon(AccountingManagerResources.INSTANCE
.accountingUnith24());
unitButton.setIcon(AccountingManagerResources.INSTANCE.accountingUnith24());
updateChart();
}
});
@ -405,20 +385,17 @@ public class ServiceChartContextPanel extends SimpleContainer {
}
private void onDownloadCSV() {
ExportRequestEvent event = new ExportRequestEvent(ExportType.CSV,
accountingStateData.getAccountingType());
ExportRequestEvent event = new ExportRequestEvent(ExportType.CSV, accountingStateData.getAccountingType());
eventBus.fireEvent(event);
}
private void onDownloadXML() {
ExportRequestEvent event = new ExportRequestEvent(ExportType.XML,
accountingStateData.getAccountingType());
ExportRequestEvent event = new ExportRequestEvent(ExportType.XML, accountingStateData.getAccountingType());
eventBus.fireEvent(event);
}
private void onDownloadJSON() {
ExportRequestEvent event = new ExportRequestEvent(ExportType.JSON,
accountingStateData.getAccountingType());
ExportRequestEvent event = new ExportRequestEvent(ExportType.JSON, accountingStateData.getAccountingType());
eventBus.fireEvent(event);
}
@ -475,15 +452,13 @@ public class ServiceChartContextPanel extends SimpleContainer {
}-*/;
private void createChart() {
SeriesService seriesService = (SeriesService) accountingStateData
.getSeriesResponse();
SeriesService seriesService = (SeriesService) accountingStateData.getSeriesResponse();
if (!(seriesService.getSerieServiceDefinition() instanceof SeriesServiceContext)) {
Log.debug("Invalid SeriesServiceContext!");
return;
}
SeriesServiceContext seriesServiceContext = (SeriesServiceContext) seriesService
.getSerieServiceDefinition();
SeriesServiceContext seriesServiceContext = (SeriesServiceContext) seriesService.getSerieServiceDefinition();
HighchartsOptionFactory highchartsFactory = new JsoHighchartsOptionFactory();
@ -494,7 +469,8 @@ public class ServiceChartContextPanel extends SimpleContainer {
options.title().text("Accounting Service Context");
/*
* options.subtitle().text("Click and drag in the plot area to zoom in");
* options.subtitle().text("Click and drag in the plot area to zoom in"
* );
*/
ArrayString colors = options.colors();
@ -504,22 +480,19 @@ public class ServiceChartContextPanel extends SimpleContainer {
// yAxis
options.setFieldAsJsonObject("yAxis", retrieveYAxis(colors));
options.plotOptions().setFieldAsJsonObject(
"column",
"{ " + "\"stacking\": \"normal\"," + "\"dataLabels\": { "
+ " \"enabled\": \"true\","
options.plotOptions().setFieldAsJsonObject("column",
"{ " + "\"stacking\": \"normal\"," + "\"dataLabels\": { " + " \"enabled\": \"true\","
+ " \"color\": \"white\", " + " \"style\": {"
+ " \"textShadow\": \"0 0 3px black\"" + " }"
+ " }" + " }");
+ " \"textShadow\": \"0 0 3px black\"" + " }" + " }" + " }");
ArrayList<SeriesColumn> seriesColumn = new ArrayList<>();
/*if (seriesServiceContext.getShowOthers()) {
createSeriesColumnShowOthers(seriesServiceContext, highchartsFactory,
colors, seriesColumn);
} else {*/
createSeriesColumnSimple(seriesServiceContext, highchartsFactory,
colors, seriesColumn);
/*}*/
/*
* if (seriesServiceContext.getShowOthers()) {
* createSeriesColumnShowOthers(seriesServiceContext, highchartsFactory,
* colors, seriesColumn); } else {
*/
createSeriesColumnSimple(seriesServiceContext, highchartsFactory, colors, seriesColumn);
/* } */
for (SeriesColumn serie : seriesColumn) {
options.series().addToEnd(serie);
}
@ -530,68 +503,56 @@ public class ServiceChartContextPanel extends SimpleContainer {
return;
}
private void createSeriesColumnShowOthers(
SeriesServiceContext seriesServiceContext,
HighchartsOptionFactory highchartsFactory, ArrayString colors,
ArrayList<SeriesColumn> seriesColumn) {
private void createSeriesColumnShowOthers(SeriesServiceContext seriesServiceContext,
HighchartsOptionFactory highchartsFactory, ArrayString colors, ArrayList<SeriesColumn> seriesColumn) {
Log.debug("Series ShowOthers");
if (accountingStateData.getSeriesRequest().getAccountingPeriod()
.getPeriod().compareTo(AccountingPeriodMode.DAILY) == 0
|| accountingStateData.getSeriesRequest().getAccountingPeriod()
.getPeriod().compareTo(AccountingPeriodMode.HOURLY) == 0
|| accountingStateData.getSeriesRequest().getAccountingPeriod()
.getPeriod().compareTo(AccountingPeriodMode.MINUTELY) == 0) {
if (accountingStateData.getSeriesRequest().getAccountingPeriod().getPeriod()
.compareTo(AccountingPeriodMode.DAILY) == 0
|| accountingStateData.getSeriesRequest().getAccountingPeriod().getPeriod()
.compareTo(AccountingPeriodMode.HOURLY) == 0
|| accountingStateData.getSeriesRequest().getAccountingPeriod().getPeriod()
.compareTo(AccountingPeriodMode.MINUTELY) == 0) {
double minRange = ChartTimeMeasure
.calculateMinRange(accountingStateData.getSeriesRequest()
.getAccountingPeriod());
.calculateMinRange(accountingStateData.getSeriesRequest().getAccountingPeriod());
double interval = ChartTimeMeasure
.calculateInterval(accountingStateData.getSeriesRequest()
.getAccountingPeriod());
.calculateInterval(accountingStateData.getSeriesRequest().getAccountingPeriod());
Date dateStart = dtf.parse(accountingStateData.getSeriesRequest()
.getAccountingPeriod().getStartDate());
Date dateStart = dtf.parse(accountingStateData.getSeriesRequest().getAccountingPeriod().getStartDate());
dateStart.setTime(dateStart.getTime()
+ ChartTimeMeasure.timeZoneOffset()
* ChartTimeMeasure.MINUTE);
dateStart.setTime(dateStart.getTime() + ChartTimeMeasure.timeZoneOffset() * ChartTimeMeasure.MINUTE);
Log.debug("BuildChart DateStart: "
+ DateTimeFormat.getFormat(PredefinedFormat.DATE_TIME_FULL)
.format(dateStart));
+ DateTimeFormat.getFormat(PredefinedFormat.DATE_TIME_FULL).format(dateStart));
// xAxis
options.xAxis().type("datetime");
options.xAxis().minRange(minRange);
options.tooltip().xDateFormat("Selected Data");
int i = 0;
for (; i < seriesServiceContext.getSeriesServiceDataContextList().size()
&& i < MAX_NUMBER_OF_CONTEXT; i++) {
SeriesColumn seriesColumnData = highchartsFactory
.createSeriesColumn();
SeriesColumn seriesColumnData = highchartsFactory.createSeriesColumn();
seriesColumnData.name(seriesServiceContext
.getSeriesServiceDataContextList().get(i).getContext());
seriesColumnData.name(seriesServiceContext.getSeriesServiceDataContextList().get(i).getContext());
seriesColumnData.color(colors.get(i));
seriesColumnData.type("column");
ArrayNumber data = seriesColumnData.dataAsArrayNumber();
for (SeriesServiceData seriesServiceData : seriesServiceContext
.getSeriesServiceDataContextList().get(i).getSeries()) {
for (SeriesServiceData seriesServiceData : seriesServiceContext.getSeriesServiceDataContextList().get(i)
.getSeries()) {
switch (measure) {
case Duration:
data.push(seriesServiceData.getDuration() / unitMeasure);
break;
case MaxInvocationTime:
data.push(seriesServiceData.getMaxInvocationTime()
/ unitMeasure);
data.push(seriesServiceData.getMaxInvocationTime() / unitMeasure);
break;
case MinInvocationTime:
data.push(seriesServiceData.getMinInvocationTime()
/ unitMeasure);
data.push(seriesServiceData.getMinInvocationTime() / unitMeasure);
break;
case OperationCount:
data.push(seriesServiceData.getOperationCount());
@ -604,80 +565,63 @@ public class ServiceChartContextPanel extends SimpleContainer {
}
seriesColumnData.pointInterval(interval).pointStart(
dateStart.getTime());
seriesColumnData.pointInterval(interval).pointStart(dateStart.getTime());
seriesColumn.add(seriesColumnData);
}
if (i < seriesServiceContext.getSeriesServiceDataContextList().size()) {
SeriesColumn seriesColumnData = highchartsFactory
.createSeriesColumn();
SeriesColumn seriesColumnData = highchartsFactory.createSeriesColumn();
seriesColumnData.name("Others");
seriesColumnData.color(colors.get(i));
seriesColumnData.type("column");
ArrayList<Long> othersData = new ArrayList<>();
for (int j = i; j < seriesServiceContext
.getSeriesServiceDataContextList().size(); j++) {
for (int j = i; j < seriesServiceContext.getSeriesServiceDataContextList().size(); j++) {
Long value;
for (int k = 0; k < seriesServiceContext
.getSeriesServiceDataContextList().get(j).getSeries()
for (int k = 0; k < seriesServiceContext.getSeriesServiceDataContextList().get(j).getSeries()
.size(); k++) {
SeriesServiceData seriesServiceData = seriesServiceContext
.getSeriesServiceDataContextList().get(j)
.getSeries().get(k);
SeriesServiceData seriesServiceData = seriesServiceContext.getSeriesServiceDataContextList()
.get(j).getSeries().get(k);
if (j == i) {
switch (measure) {
case Duration:
othersData.add(seriesServiceData.getDuration()
/ unitMeasure);
othersData.add(seriesServiceData.getDuration() / unitMeasure);
break;
case MaxInvocationTime:
othersData.add(seriesServiceData
.getMaxInvocationTime() / unitMeasure);
othersData.add(seriesServiceData.getMaxInvocationTime() / unitMeasure);
break;
case MinInvocationTime:
othersData.add(seriesServiceData
.getMinInvocationTime() / unitMeasure);
othersData.add(seriesServiceData.getMinInvocationTime() / unitMeasure);
break;
case OperationCount:
othersData.add(seriesServiceData
.getOperationCount());
othersData.add(seriesServiceData.getOperationCount());
break;
default:
othersData.add(seriesServiceData.getDuration()
/ unitMeasure);
othersData.add(seriesServiceData.getDuration() / unitMeasure);
break;
}
} else {
switch (measure) {
case Duration:
value = (seriesServiceData.getDuration() / unitMeasure)
+ othersData.get(k);
value = (seriesServiceData.getDuration() / unitMeasure) + othersData.get(k);
othersData.set(k, value);
break;
case MaxInvocationTime:
value = (seriesServiceData
.getMaxInvocationTime() / unitMeasure)
+ othersData.get(k);
value = (seriesServiceData.getMaxInvocationTime() / unitMeasure) + othersData.get(k);
othersData.set(k, value);
break;
case MinInvocationTime:
value = (seriesServiceData
.getMinInvocationTime() / unitMeasure)
+ othersData.get(k);
value = (seriesServiceData.getMinInvocationTime() / unitMeasure) + othersData.get(k);
othersData.set(k, value);
break;
case OperationCount:
value = seriesServiceData.getOperationCount()
+ othersData.get(k);
value = seriesServiceData.getOperationCount() + othersData.get(k);
othersData.set(k, value);
break;
default:
value = (seriesServiceData.getDuration() / unitMeasure)
+ othersData.get(k);
value = (seriesServiceData.getDuration() / unitMeasure) + othersData.get(k);
othersData.set(k, value);
break;
@ -694,8 +638,7 @@ public class ServiceChartContextPanel extends SimpleContainer {
data.push(value);
}
seriesColumnData.pointInterval(interval).pointStart(
dateStart.getTime());
seriesColumnData.pointInterval(interval).pointStart(dateStart.getTime());
seriesColumn.add(seriesColumnData);
}
@ -703,17 +646,16 @@ public class ServiceChartContextPanel extends SimpleContainer {
// xAxis
options.xAxis().type("datetime");
if (accountingStateData.getSeriesRequest().getAccountingPeriod()
.getPeriod().compareTo(AccountingPeriodMode.MONTHLY) == 0) {
//options.tooltip().xDateFormat("%b, %Y");
if (accountingStateData.getSeriesRequest().getAccountingPeriod().getPeriod()
.compareTo(AccountingPeriodMode.MONTHLY) == 0) {
// options.tooltip().xDateFormat("%b, %Y");
options.tooltip().xDateFormat("Selected Data");
} else {
if (accountingStateData.getSeriesRequest()
.getAccountingPeriod().getPeriod()
if (accountingStateData.getSeriesRequest().getAccountingPeriod().getPeriod()
.compareTo(AccountingPeriodMode.YEARLY) == 0) {
//options.tooltip().xDateFormat("%Y");
options.tooltip().xDateFormat("Selected Data");
// options.tooltip().xDateFormat("%Y");
options.tooltip().xDateFormat("Selected Data");
} else {
options.tooltip().xDateFormat("Selected Data");
@ -724,23 +666,19 @@ public class ServiceChartContextPanel extends SimpleContainer {
int i = 0;
for (; i < seriesServiceContext.getSeriesServiceDataContextList().size()
&& i < MAX_NUMBER_OF_CONTEXT; i++) {
SeriesColumn seriesColumnData = highchartsFactory
.createSeriesColumn();
SeriesColumn seriesColumnData = highchartsFactory.createSeriesColumn();
seriesColumnData.name(seriesServiceContext
.getSeriesServiceDataContextList().get(i).getContext()
);
seriesColumnData.name(seriesServiceContext.getSeriesServiceDataContextList().get(i).getContext());
seriesColumnData.color(colors.get(i));
seriesColumnData.type("column");
Array<Data> arrayData = seriesColumnData.dataAsArrayObject();
for (SeriesServiceData seriesServiceData : seriesServiceContext
.getSeriesServiceDataContextList().get(i).getSeries()) {
for (SeriesServiceData seriesServiceData : seriesServiceContext.getSeriesServiceDataContextList().get(i)
.getSeries()) {
long dateFrom1970 = seriesServiceData.getDate().getTime();
Log.debug("SeriersServiceData: "
+ seriesServiceData.getDate());
Log.debug("SeriersServiceData: " + seriesServiceData.getDate());
Log.debug("SeriersServiceData: " + dateFrom1970);
Data data = highchartsFactory.createSeriesColumnData();
@ -753,14 +691,12 @@ public class ServiceChartContextPanel extends SimpleContainer {
break;
case MaxInvocationTime:
data.x(dateFrom1970);
data.y(seriesServiceData.getMaxInvocationTime()
/ unitMeasure);
data.y(seriesServiceData.getMaxInvocationTime() / unitMeasure);
arrayData.addToEnd(data);
break;
case MinInvocationTime:
data.x(dateFrom1970);
data.y(seriesServiceData.getMinInvocationTime()
/ unitMeasure);
data.y(seriesServiceData.getMinInvocationTime() / unitMeasure);
arrayData.addToEnd(data);
break;
case OperationCount:
@ -783,99 +719,74 @@ public class ServiceChartContextPanel extends SimpleContainer {
}
if (i < seriesServiceContext.getSeriesServiceDataContextList().size()) {
SeriesColumn seriesColumnData = highchartsFactory
.createSeriesColumn();
SeriesColumn seriesColumnData = highchartsFactory.createSeriesColumn();
seriesColumnData.name("Others");
seriesColumnData.color(colors.get(i));
seriesColumnData.type("column");
ArrayList<ChartDateTimeData> othersData = new ArrayList<>();
for (int j = i; j < seriesServiceContext
.getSeriesServiceDataContextList().size(); j++) {
for (int j = i; j < seriesServiceContext.getSeriesServiceDataContextList().size(); j++) {
ChartDateTimeData chartDateTimeData;
for (int k = 0; k < seriesServiceContext
.getSeriesServiceDataContextList().get(j).getSeries()
for (int k = 0; k < seriesServiceContext.getSeriesServiceDataContextList().get(j).getSeries()
.size(); k++) {
SeriesServiceData seriesServiceData = seriesServiceContext
.getSeriesServiceDataContextList().get(j)
.getSeries().get(k);
SeriesServiceData seriesServiceData = seriesServiceContext.getSeriesServiceDataContextList()
.get(j).getSeries().get(k);
if (j == i) {
switch (measure) {
case Duration:
chartDateTimeData = new ChartDateTimeData(
seriesServiceData.getDate(),
seriesServiceData.getDuration()
/ unitMeasure);
chartDateTimeData = new ChartDateTimeData(seriesServiceData.getDate(),
seriesServiceData.getDuration() / unitMeasure);
othersData.add(chartDateTimeData);
break;
case MaxInvocationTime:
chartDateTimeData = new ChartDateTimeData(
seriesServiceData.getDate(),
seriesServiceData
.getMaxInvocationTime()
/ unitMeasure);
chartDateTimeData = new ChartDateTimeData(seriesServiceData.getDate(),
seriesServiceData.getMaxInvocationTime() / unitMeasure);
othersData.add(chartDateTimeData);
break;
case MinInvocationTime:
chartDateTimeData = new ChartDateTimeData(
seriesServiceData.getDate(),
seriesServiceData
.getMinInvocationTime()
/ unitMeasure);
chartDateTimeData = new ChartDateTimeData(seriesServiceData.getDate(),
seriesServiceData.getMinInvocationTime() / unitMeasure);
othersData.add(chartDateTimeData);
break;
case OperationCount:
chartDateTimeData = new ChartDateTimeData(
seriesServiceData.getDate(),
chartDateTimeData = new ChartDateTimeData(seriesServiceData.getDate(),
seriesServiceData.getOperationCount());
othersData.add(chartDateTimeData);
break;
default:
chartDateTimeData = new ChartDateTimeData(
seriesServiceData.getDate(),
seriesServiceData.getDuration()
/ unitMeasure);
chartDateTimeData = new ChartDateTimeData(seriesServiceData.getDate(),
seriesServiceData.getDuration() / unitMeasure);
othersData.add(chartDateTimeData);
break;
}
} else {
switch (measure) {
case Duration:
chartDateTimeData = new ChartDateTimeData(
seriesServiceData.getDate(),
(seriesServiceData.getDuration() / unitMeasure)
+ othersData.get(k).getValue());
chartDateTimeData = new ChartDateTimeData(seriesServiceData.getDate(),
(seriesServiceData.getDuration() / unitMeasure) + othersData.get(k).getValue());
othersData.set(k, chartDateTimeData);
break;
case MaxInvocationTime:
chartDateTimeData = new ChartDateTimeData(
seriesServiceData.getDate(),
(seriesServiceData
.getMaxInvocationTime() / unitMeasure)
chartDateTimeData = new ChartDateTimeData(seriesServiceData.getDate(),
(seriesServiceData.getMaxInvocationTime() / unitMeasure)
+ othersData.get(k).getValue());
othersData.set(k, chartDateTimeData);
break;
case MinInvocationTime:
chartDateTimeData = new ChartDateTimeData(
seriesServiceData.getDate(),
(seriesServiceData
.getMinInvocationTime() / unitMeasure)
chartDateTimeData = new ChartDateTimeData(seriesServiceData.getDate(),
(seriesServiceData.getMinInvocationTime() / unitMeasure)
+ othersData.get(k).getValue());
othersData.set(k, chartDateTimeData);
break;
case OperationCount:
chartDateTimeData = new ChartDateTimeData(
seriesServiceData.getDate(),
seriesServiceData.getOperationCount()
+ othersData.get(k).getValue());
chartDateTimeData = new ChartDateTimeData(seriesServiceData.getDate(),
seriesServiceData.getOperationCount() + othersData.get(k).getValue());
othersData.set(k, chartDateTimeData);
break;
default:
chartDateTimeData = new ChartDateTimeData(
seriesServiceData.getDate(),
(seriesServiceData.getDuration() / unitMeasure)
+ othersData.get(k).getValue());
chartDateTimeData = new ChartDateTimeData(seriesServiceData.getDate(),
(seriesServiceData.getDuration() / unitMeasure) + othersData.get(k).getValue());
othersData.set(k, chartDateTimeData);
break;
@ -891,8 +802,7 @@ public class ServiceChartContextPanel extends SimpleContainer {
for (ChartDateTimeData chartDateTimeData : othersData) {
long dateFrom1970 = chartDateTimeData.getDate().getTime();
Log.debug("SeriersOthersData: "
+ chartDateTimeData.getDate());
Log.debug("SeriersOthersData: " + chartDateTimeData.getDate());
Log.debug("SeriersOthersData: " + dateFrom1970);
Data data = highchartsFactory.createSeriesColumnData();
@ -911,66 +821,53 @@ public class ServiceChartContextPanel extends SimpleContainer {
}
private void createSeriesColumnSimple(SeriesServiceContext seriesServiceContext,
HighchartsOptionFactory highchartsFactory, ArrayString colors,
ArrayList<SeriesColumn> seriesColumn) {
HighchartsOptionFactory highchartsFactory, ArrayString colors, ArrayList<SeriesColumn> seriesColumn) {
Log.debug("Series Simple");
if (accountingStateData.getSeriesRequest().getAccountingPeriod()
.getPeriod().compareTo(AccountingPeriodMode.DAILY) == 0
|| accountingStateData.getSeriesRequest().getAccountingPeriod()
.getPeriod().compareTo(AccountingPeriodMode.HOURLY) == 0
|| accountingStateData.getSeriesRequest().getAccountingPeriod()
.getPeriod().compareTo(AccountingPeriodMode.MINUTELY) == 0) {
if (accountingStateData.getSeriesRequest().getAccountingPeriod().getPeriod()
.compareTo(AccountingPeriodMode.DAILY) == 0
|| accountingStateData.getSeriesRequest().getAccountingPeriod().getPeriod()
.compareTo(AccountingPeriodMode.HOURLY) == 0
|| accountingStateData.getSeriesRequest().getAccountingPeriod().getPeriod()
.compareTo(AccountingPeriodMode.MINUTELY) == 0) {
double minRange = ChartTimeMeasure
.calculateMinRange(accountingStateData.getSeriesRequest()
.getAccountingPeriod());
.calculateMinRange(accountingStateData.getSeriesRequest().getAccountingPeriod());
double interval = ChartTimeMeasure
.calculateInterval(accountingStateData.getSeriesRequest()
.getAccountingPeriod());
.calculateInterval(accountingStateData.getSeriesRequest().getAccountingPeriod());
Date dateStart = dtf.parse(accountingStateData.getSeriesRequest()
.getAccountingPeriod().getStartDate());
Date dateStart = dtf.parse(accountingStateData.getSeriesRequest().getAccountingPeriod().getStartDate());
dateStart.setTime(dateStart.getTime()
+ ChartTimeMeasure.timeZoneOffset()
* ChartTimeMeasure.MINUTE);
dateStart.setTime(dateStart.getTime() + ChartTimeMeasure.timeZoneOffset() * ChartTimeMeasure.MINUTE);
Log.debug("BuildChart DateStart: "
+ DateTimeFormat.getFormat(PredefinedFormat.DATE_TIME_FULL)
.format(dateStart));
+ DateTimeFormat.getFormat(PredefinedFormat.DATE_TIME_FULL).format(dateStart));
// xAxis
options.xAxis().type("datetime");
options.xAxis().minRange(minRange);
options.tooltip().xDateFormat("Selected Data");
for (int i = 0; i < seriesServiceContext.getSeriesServiceDataContextList()
.size(); i++) {
SeriesColumn seriesColumnData = highchartsFactory
.createSeriesColumn();
for (int i = 0; i < seriesServiceContext.getSeriesServiceDataContextList().size(); i++) {
SeriesColumn seriesColumnData = highchartsFactory.createSeriesColumn();
seriesColumnData.name(seriesServiceContext
.getSeriesServiceDataContextList().get(i).getContext()
);
seriesColumnData.name(seriesServiceContext.getSeriesServiceDataContextList().get(i).getContext());
seriesColumnData.color(colors.get(i));
seriesColumnData.type("column");
ArrayNumber data = seriesColumnData.dataAsArrayNumber();
for (SeriesServiceData seriesServiceData : seriesServiceContext
.getSeriesServiceDataContextList().get(i).getSeries()) {
for (SeriesServiceData seriesServiceData : seriesServiceContext.getSeriesServiceDataContextList().get(i)
.getSeries()) {
switch (measure) {
case Duration:
data.push(seriesServiceData.getDuration() / unitMeasure);
break;
case MaxInvocationTime:
data.push(seriesServiceData.getMaxInvocationTime()
/ unitMeasure);
data.push(seriesServiceData.getMaxInvocationTime() / unitMeasure);
break;
case MinInvocationTime:
data.push(seriesServiceData.getMinInvocationTime()
/ unitMeasure);
data.push(seriesServiceData.getMinInvocationTime() / unitMeasure);
break;
case OperationCount:
data.push(seriesServiceData.getOperationCount());
@ -983,8 +880,7 @@ public class ServiceChartContextPanel extends SimpleContainer {
}
seriesColumnData.pointInterval(interval).pointStart(
dateStart.getTime());
seriesColumnData.pointInterval(interval).pointStart(dateStart.getTime());
seriesColumn.add(seriesColumnData);
}
@ -992,16 +888,15 @@ public class ServiceChartContextPanel extends SimpleContainer {
// xAxis
options.xAxis().type("datetime");
if (accountingStateData.getSeriesRequest().getAccountingPeriod()
.getPeriod().compareTo(AccountingPeriodMode.MONTHLY) == 0) {
//options.tooltip().xDateFormat("%b, %Y");
if (accountingStateData.getSeriesRequest().getAccountingPeriod().getPeriod()
.compareTo(AccountingPeriodMode.MONTHLY) == 0) {
// options.tooltip().xDateFormat("%b, %Y");
options.tooltip().xDateFormat("Selected Data");
} else {
if (accountingStateData.getSeriesRequest()
.getAccountingPeriod().getPeriod()
if (accountingStateData.getSeriesRequest().getAccountingPeriod().getPeriod()
.compareTo(AccountingPeriodMode.YEARLY) == 0) {
//options.tooltip().xDateFormat("%Y");
// options.tooltip().xDateFormat("%Y");
options.tooltip().xDateFormat("Selected Data");
} else {
@ -1010,24 +905,20 @@ public class ServiceChartContextPanel extends SimpleContainer {
}
for (int i = 0; i < seriesServiceContext.getSeriesServiceDataContextList()
.size(); i++) {
SeriesColumn seriesColumnData = highchartsFactory
.createSeriesColumn();
for (int i = 0; i < seriesServiceContext.getSeriesServiceDataContextList().size(); i++) {
SeriesColumn seriesColumnData = highchartsFactory.createSeriesColumn();
seriesColumnData.name(seriesServiceContext
.getSeriesServiceDataContextList().get(i).getContext());
seriesColumnData.name(seriesServiceContext.getSeriesServiceDataContextList().get(i).getContext());
seriesColumnData.color(colors.get(i));
seriesColumnData.type("column");
Array<Data> arrayData = seriesColumnData.dataAsArrayObject();
for (SeriesServiceData seriesServiceData : seriesServiceContext
.getSeriesServiceDataContextList().get(i).getSeries()) {
for (SeriesServiceData seriesServiceData : seriesServiceContext.getSeriesServiceDataContextList().get(i)
.getSeries()) {
long dateFrom1970 = seriesServiceData.getDate().getTime();
Log.debug("SeriersServiceData: "
+ seriesServiceData.getDate());
Log.debug("SeriersServiceData: " + seriesServiceData.getDate());
Log.debug("SeriersServiceData: " + dateFrom1970);
Data data = highchartsFactory.createSeriesColumnData();
@ -1040,14 +931,12 @@ public class ServiceChartContextPanel extends SimpleContainer {
break;
case MaxInvocationTime:
data.x(dateFrom1970);
data.y(seriesServiceData.getMaxInvocationTime()
/ unitMeasure);
data.y(seriesServiceData.getMaxInvocationTime() / unitMeasure);
arrayData.addToEnd(data);
break;
case MinInvocationTime:
data.x(dateFrom1970);
data.y(seriesServiceData.getMinInvocationTime()
/ unitMeasure);
data.y(seriesServiceData.getMinInvocationTime() / unitMeasure);
arrayData.addToEnd(data);
break;
case OperationCount:
@ -1074,68 +963,44 @@ public class ServiceChartContextPanel extends SimpleContainer {
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\": \""
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) + "\"" + " }" + " }" + "}]";
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) + "\"" + " }" + " }" + "}]";
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) + "\"" + " }" + " }" + "}]";
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) + "\"" + " }" + " }" + "}]";
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\": \""
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) + "\"" + " }" + " }" + "}]";
}