%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/waritko/jHackHistory/ROOT/
Upload File :
Create Path :
Current File : //home/waritko/jHackHistory/ROOT/stats.jsp

<%@ page import="net.varak.HackHistory.StaticHelper" %>
<%@ page import="net.varak.HackHistory.entities.statistics.DailyHacks" %>
<%@ page import="net.varak.HackHistory.entities.statistics.ItemProbability" %>
<%@ page import="net.varak.HackHistory.model.StatisticsProvider" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.Locale" %>
<%@ page import="java.util.Map" %>
<%@ page import="org.joda.time.DateTime" %>
<%--
  Created by IntelliJ IDEA.
  User: waritko
  Date: 17. 9. 2014
  Time: 18:07
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    List<DailyHacks> dailyHacks = StatisticsProvider.dailyHacks();
    ArrayList<Object[]> outData = new ArrayList<Object[]>(dailyHacks.size());
    outData.add(new Object[] {"Date", "Count"});
    for(DailyHacks hack : dailyHacks)
    {
        Object[] row = new Object[2];
        row[0] = hack.getDate();
        row[1] = hack.getCount();
        outData.add(row);
    }
%>
<html>
<head>
    <title></title>
    <link href="./static/css/design.css" rel="stylesheet">
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
        google.load("visualization", "1", {packages:["corechart"]});
        google.setOnLoadCallback(drawChart);
        function drawChart() {
            var data = google.visualization.arrayToDataTable(
                    <%=StaticHelper.getObjectMapper().writeValueAsString(outData)%>
            );

            var options = {
                title: 'Daily hack count',
                curveType: 'function',
                legend: { position: 'bottom' }
            };

            var chart = new google.visualization.LineChart(document.getElementById('chart_div'));

            chart.draw(data, options);
        }
    </script>
</head>
<body>
    <div id="chart_div" style="width: 960px; height: 500px;"></div>
    <div style="height: 3em;"></div>
    <h3>All time</h3>
    <table class="row">
    <% for(ItemProbability itemProbability : StatisticsProvider.itemProbabilities()) { %>
        <tr>
            <td style="padding-left: 0.75em; padding-right: 0.75em;" class="item-rarity-<%=itemProbability.getRarity().toString().toLowerCase().replace('_', '-')%>"><%=itemProbability.getType()%></td>
            <td style="padding-left: 0.75em; padding-right: 0.75em;"><%=String.format(Locale.US, "%1$.4f", 1/itemProbability.getCountInHack())%></td>
            <td style="padding-left: 0.75em; padding-right: 0.75em;"><%=String.format(Locale.US, "%1$.4f", itemProbability.getCountInHack())%></td>
            <td style="padding-left: 0.75em; padding-right: 0.75em;"><%=itemProbability.getItemsHacked()%></td>
        </tr>
    <% } %>
    </table>

    <h3>Last 30 days (<%=String.valueOf(StatisticsProvider.hackCounts(DateTime.now().minusDays(30)))%> hacks)</h3>
    <table class="row">
        <% for(ItemProbability itemProbability : StatisticsProvider.itemProbabilities(DateTime.now().minusDays(30))) { %>
        <tr>
            <td style="padding-left: 0.75em; padding-right: 0.75em;" class="item-rarity-<%=itemProbability.getRarity().toString().toLowerCase().replace('_', '-')%>"><%=itemProbability.getType()%></td>
            <td style="padding-left: 0.75em; padding-right: 0.75em;"><%=String.format(Locale.US, "%1$.4f", 1/itemProbability.getCountInHack())%></td>
            <td style="padding-left: 0.75em; padding-right: 0.75em;"><%=String.format(Locale.US, "%1$.4f", itemProbability.getCountInHack())%></td>
            <td style="padding-left: 0.75em; padding-right: 0.75em;"><%=itemProbability.getItemsHacked()%></td>
        </tr>
        <% } %>
    </table>

    <h3>Last 7 days (<%=String.valueOf(StatisticsProvider.hackCounts(DateTime.now().minusDays(7)))%> hacks)</h3>
    <table class="row">
        <% for(ItemProbability itemProbability : StatisticsProvider.itemProbabilities(DateTime.now().minusDays(7))) { %>
        <tr>
            <td style="padding-left: 0.75em; padding-right: 0.75em;" class="item-rarity-<%=itemProbability.getRarity().toString().toLowerCase().replace('_', '-')%>"><%=itemProbability.getType()%></td>
            <td style="padding-left: 0.75em; padding-right: 0.75em;"><%=String.format(Locale.US, "%1$.4f", 1/itemProbability.getCountInHack())%></td>
            <td style="padding-left: 0.75em; padding-right: 0.75em;"><%=String.format(Locale.US, "%1$.4f", itemProbability.getCountInHack())%></td>
            <td style="padding-left: 0.75em; padding-right: 0.75em;"><%=itemProbability.getItemsHacked()%></td>
        </tr>
        <% } %>
    </table>

    <h3>Last 24 hours (<%=String.valueOf(StatisticsProvider.hackCounts(DateTime.now().minusHours(24)))%> hacks)</h3>
    <table class="row">
        <% for(ItemProbability itemProbability : StatisticsProvider.itemProbabilities(DateTime.now().minusHours(24))) { %>
        <tr>
            <td style="padding-left: 0.75em; padding-right: 0.75em;" class="item-rarity-<%=itemProbability.getRarity().toString().toLowerCase().replace('_', '-')%>"><%=itemProbability.getType()%></td>
            <td style="padding-left: 0.75em; padding-right: 0.75em;"><%=String.format(Locale.US, "%1$.4f", 1/itemProbability.getCountInHack())%></td>
            <td style="padding-left: 0.75em; padding-right: 0.75em;"><%=String.format(Locale.US, "%1$.4f", itemProbability.getCountInHack())%></td>
            <td style="padding-left: 0.75em; padding-right: 0.75em;"><%=itemProbability.getItemsHacked()%></td>
        </tr>
        <% } %>
    </table>

    <h2>Item probabilities from various events</h2>
    <% for(Map.Entry<String, ArrayList<ItemProbability>> eventProbabilities : StatisticsProvider.eventItemsProbabilities().entrySet()) { %>
    <% Map<String, Integer> hacksCounts = StatisticsProvider.eventHacksCount(); %>
    <h3><%=eventProbabilities.getKey()%> (<%=hacksCounts.get(eventProbabilities.getKey())%> hacks)</h3>
    <table class="row">
        <% for(ItemProbability itemProbability : eventProbabilities.getValue()) { %>
        <tr>
            <td style="padding-left: 0.75em; padding-right: 0.75em;" class="item-rarity-<%=itemProbability.getRarity().toString().toLowerCase().replace('_', '-')%>"><%=itemProbability.getType()%></td>
            <td style="padding-left: 0.75em; padding-right: 0.75em;"><%=String.format(Locale.US, "%1$.4f", 1/itemProbability.getCountInHack())%></td>
            <td style="padding-left: 0.75em; padding-right: 0.75em;"><%=String.format(Locale.US, "%1$.4f", itemProbability.getCountInHack())%></td>
            <td style="padding-left: 0.75em; padding-right: 0.75em;"><%=itemProbability.getItemsHacked()%></td>
        </tr>
        <% } %>
    </table>
    <% } %>
</body>
</html>

Zerion Mini Shell 1.0