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"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <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> <attributes>
<attribute name="optional" value="true"/> <attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </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> <attributes>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
@ -45,5 +45,5 @@
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </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> </classpath>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0"> <?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="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/> <wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>

View File

@ -1,4 +1,8 @@
<ReleaseNotes> <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" <Changeset component="org.gcube.portlets.admin.accounting-manager.1-8-0"
date="2017-10-01"> date="2017-10-01">
<Change>Updated to new version of accounting client library</Change> <Change>Updated to new version of accounting client library</Change>

View File

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

View File

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

View File

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

View File

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