Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

rate display fixed

  • Loading branch information...
commit 4b88808c744cf1bfd6a345d2c4f564b76ddd10b2 1 parent cc83265
@juricababic juricababic authored
View
37 src/main/java/org/powertac/visualizer/domain/broker/TariffInfo.java
@@ -52,18 +52,45 @@ public TariffInfo(TariffSpecification tariffSpecification) {
json.setRatesLineChartMaxValue(rateInfo.getJson().getRateLineChartMaxValue());
json.setRatesLineChartMinValue(rateInfo.getJson().getRateLineChartMinValue());
} else {
-
+
+ JSONArray ratesJsonMax = new JSONArray();
+ JSONArray ratesJsonMin = new JSONArray();
+
for (Iterator iterator = rates.iterator(); iterator.hasNext();) {
Rate rate = (Rate) iterator.next();
RateInfo rateInfo = new RateInfo(rate);
rateInfos.add(rateInfo);
-
- json.getRatesLineChartMaxValue().put(rateInfo.getJson().getRateLineChartMaxValue());
- json.getRatesLineChartMinValue().put(rateInfo.getJson().getRateLineChartMinValue());
+
+ JSONArray maxArray = rateInfo.getJson().getRateLineChartMaxValue();
+ JSONArray minArray = rateInfo.getJson().getRateLineChartMinValue();
+
+ for(int i=0;i<maxArray.length();i++)
+ {
+ try {
+ ratesJsonMax.put(maxArray.get(i));
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+
+ for(int i=0;i<minArray.length();i++)
+ {
+ try {
+ ratesJsonMin.put(minArray.get(i));
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+
+
+
}
-
+
+ json.setRatesLineChartMaxValue(ratesJsonMax);
+ json.setRatesLineChartMinValue(ratesJsonMin);
}
+
tariffLifecycle.add(tariffSpecification.toString());
}
View
122 src/main/webapp/WEB-INF/tags/brokers.xhtml
@@ -422,13 +422,13 @@
</p:dataTable>
<p:tabView dynamic="true" cache="true">
- <p:tab title="Total Revenue">
- <p:panel rendered="#{not empty brokersBean.selectedTariffInfo}">
- <!-- Energy chart for a specific broker (24 timeslot average value) -->
- <div
- id="totalRevenueLineChart#{brokersBean.selectedTariffInfo.tariffSpecification.id}"
- style="width: 700px; height: 250px"></div>
- <script type="text/javascript">
+ <p:tab title="Total Revenue">
+ <p:panel rendered="#{not empty brokersBean.selectedTariffInfo}">
+ <!-- Energy chart for a specific broker (24 timeslot average value) -->
+ <div
+ id="totalRevenueLineChart#{brokersBean.selectedTariffInfo.tariffSpecification.id}"
+ style="width: 700px; height: 250px"></div>
+ <script type="text/javascript">
if (totalRevenueLineChart#{brokersBean.selectedTariffInfo.tariffSpecification.id}!=null) {
window.totalRevenueLineChart#{brokersBean.selectedTariffInfo.tariffSpecification.id}.destroy();
@@ -450,17 +450,17 @@
});
</script>
- </p:panel>
+ </p:panel>
- </p:tab>
+ </p:tab>
- <p:tab title="Hourly Revenue">
- <p:panel rendered="#{not empty brokersBean.selectedTariffInfo}">
- <!-- Energy chart for a specific broker (24 timeslot average value) -->
- <div
- id="hourlyRevenueLineChart#{brokersBean.selectedTariffInfo.tariffSpecification.id}"
- style="width: 700px; height: 250px"></div>
- <script type="text/javascript">
+ <p:tab title="Hourly Revenue">
+ <p:panel rendered="#{not empty brokersBean.selectedTariffInfo}">
+ <!-- Energy chart for a specific broker (24 timeslot average value) -->
+ <div
+ id="hourlyRevenueLineChart#{brokersBean.selectedTariffInfo.tariffSpecification.id}"
+ style="width: 700px; height: 250px"></div>
+ <script type="text/javascript">
if (hourlyRevenueLineChart#{brokersBean.selectedTariffInfo.tariffSpecification.id}!=null) {
window.hourlyRevenueLineChart#{brokersBean.selectedTariffInfo.tariffSpecification.id}.destroy();
@@ -482,16 +482,16 @@
});
</script>
- </p:panel>
- </p:tab>
-
- <p:tab title="Total kWh">
+ </p:panel>
+ </p:tab>
+
+ <p:tab title="Total kWh">
<p:panel rendered="#{not empty brokersBean.selectedTariffInfo}">
- <!-- Energy chart for a specific broker (24 timeslot average value) -->
- <div
- id="totalKWhLineChart#{brokersBean.selectedTariffInfo.tariffSpecification.id}"
- style="width: 700px; height: 250px"></div>
- <script type="text/javascript">
+ <!-- Energy chart for a specific broker (24 timeslot average value) -->
+ <div
+ id="totalKWhLineChart#{brokersBean.selectedTariffInfo.tariffSpecification.id}"
+ style="width: 700px; height: 250px"></div>
+ <script type="text/javascript">
if (totalKWhLineChart#{brokersBean.selectedTariffInfo.tariffSpecification.id}!=null) {
window.totalKWhLineChart#{brokersBean.selectedTariffInfo.tariffSpecification.id}.destroy();
@@ -513,16 +513,16 @@
});
</script>
- </p:panel>
- </p:tab>
+ </p:panel>
+ </p:tab>
- <p:tab title="Hourly kWh">
+ <p:tab title="Hourly kWh">
<p:panel rendered="#{not empty brokersBean.selectedTariffInfo}">
- <!-- Energy chart for a specific broker (24 timeslot average value) -->
- <div
- id="hourlyKWhLineChart#{brokersBean.selectedTariffInfo.tariffSpecification.id}"
- style="width: 700px; height: 250px"></div>
- <script type="text/javascript">
+ <!-- Energy chart for a specific broker (24 timeslot average value) -->
+ <div
+ id="hourlyKWhLineChart#{brokersBean.selectedTariffInfo.tariffSpecification.id}"
+ style="width: 700px; height: 250px"></div>
+ <script type="text/javascript">
if (hourlyKWhLineChart#{brokersBean.selectedTariffInfo.tariffSpecification.id}!=null) {
window.hourlyKWhLineChart#{brokersBean.selectedTariffInfo.tariffSpecification.id}.destroy();
@@ -544,16 +544,16 @@
});
</script>
- </p:panel>
- </p:tab>
-
- <p:tab title="Rates: Min Values">
- <p:panel rendered="#{not empty brokersBean.selectedTariffInfo}">
- <!-- Energy chart for a specific broker (24 timeslot average value) -->
- <div
- id="ratesLineChartMinValue#{brokersBean.selectedTariffInfo.tariffSpecification.id}"
- style="width: 700px; height: 250px"></div>
- <script type="text/javascript">
+ </p:panel>
+ </p:tab>
+
+ <p:tab title="Rates: Min Values">
+ <p:panel rendered="#{not empty brokersBean.selectedTariffInfo}">
+ <!-- Energy chart for a specific broker (24 timeslot average value) -->
+ <div
+ id="ratesLineChartMinValue#{brokersBean.selectedTariffInfo.tariffSpecification.id}"
+ style="width: 700px; height: 250px"></div>
+ <script type="text/javascript">
if (ratesLineChartMinValue#{brokersBean.selectedTariffInfo.tariffSpecification.id}!=null) {
window.ratesLineChartMinValue#{brokersBean.selectedTariffInfo.tariffSpecification.id}.destroy();
@@ -579,15 +579,15 @@
});
</script>
- </p:panel>
- </p:tab>
- <p:tab title="Rates: Max Values">
- <p:panel rendered="#{not empty brokersBean.selectedTariffInfo}">
- <!-- Energy chart for a specific broker (24 timeslot average value) -->
- <div
- id="ratesLineChartMaxValue#{brokersBean.selectedTariffInfo.tariffSpecification.id}"
- style="width: 700px; height: 250px"></div>
- <script type="text/javascript">
+ </p:panel>
+ </p:tab>
+ <p:tab title="Rates: Max Values">
+ <p:panel rendered="#{not empty brokersBean.selectedTariffInfo}">
+ <!-- Energy chart for a specific broker (24 timeslot average value) -->
+ <div
+ id="ratesLineChartMaxValue#{brokersBean.selectedTariffInfo.tariffSpecification.id}"
+ style="width: 700px; height: 250px"></div>
+ <script type="text/javascript">
if (ratesLineChartMaxValue#{brokersBean.selectedTariffInfo.tariffSpecification.id}!=null) {
window.ratesLineChartMaxValue#{brokersBean.selectedTariffInfo.tariffSpecification.id}.destroy();
@@ -613,13 +613,21 @@
});
</script>
- </p:panel>
- </p:tab>
-
+ </p:panel>
+ </p:tab>
-
+ <!-- <p:tab title="Tariff Lifecycle">
+ <p:dataTable var="msg" value="#{brokersBean.selectedTariffInfo.tariffLifecycle}"
+ tableStyle="width:auto" rows="5" paginator="true">
+
+ <p:column style="width:40px" headerText="Message">
+ <h:outputText value="#{msg}" />
+ </p:column>
+ </p:dataTable>
+ </p:tab>
+ -->
- </p:tabView>
+ </p:tabView>
</p:tab>
Please sign in to comment.
Something went wrong with that request. Please try again.