Prisma Puzzle Timer

I'm not sure if this deserves its own thread so I'll post it here.
I have changed the awful graph in the history section from displaying your times in relation to the date to displaying the times in relation to the number of the solve.
This eliminates the gaps, that previously appeared when there had been no times recorded for a long time, and allows for all times to be shown. Now you can see the development of your times a lot better.
Here is the download link of the executable(.jar): http://speedy.sh/agfSG/PrismaPuzzleTimer0.61.jar
I only modified the "paintComponent" Method of the "GraphPanel" class and here's the source code for the interested:
Code:
public void paintComponent(Graphics g) {
        super.paintComponent(g);

        Graphics2D g2 = (Graphics2D) g;
        g2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);

        g2.setFont(new Font("Arial", Font.BOLD, 10));

        int hBase = 16;
        int wBase = 45;

        // draw vertical line
        g2.drawLine(wBase, getHeight() - hBase, getWidth() - 1, getHeight() - hBase);

        // draw vertical ticks
        int nVerticalTicks = 5;
        for (int i = 0; i < nVerticalTicks; i++) {
            int x = wBase;
            int y = (int) (getHeight() - hBase - (i + 0.5) * (getHeight() - hBase) / nVerticalTicks);

            g2.drawLine(x - 2, y, x + 2, y);
        }

        // draw vertical labels
        double vTickInterval = (this.solutionIntervalEnd - this.solutionIntervalStart) / nVerticalTicks;
        for (int i = 0; i < nVerticalTicks; i++) {
            long value = (long) (this.solutionIntervalStart + (i + 0.5) * vTickInterval);
            String label = SolutionUtils.format(value);

            FontMetrics fontMetrics = g2.getFontMetrics();
            int width = fontMetrics.stringWidth(label);
            int height = fontMetrics.getAscent();
            int x = wBase - width - 4;
            int y = (int) (getHeight() - hBase - (i + 0.5) * (getHeight() - hBase) / nVerticalTicks + height / 2 - 1);

            g2.drawString(label, x, y);
        }
        
        // draw horizontal line
        g2.drawLine(wBase, 0, wBase, getHeight() - hBase - 1);

        // draw horizontal ticks
        int nHorizontalTicks = 11;
        for (int i = 0; i < nHorizontalTicks; i++) {
            int x = (int) (wBase + (i + 0.5) * (getWidth() - wBase) / nHorizontalTicks);
            int y = getHeight() - hBase;

            g2.drawLine(x, y - 2, x, y + 2);
        }

        // draw horizontal labels
        for (int i = 0; i < nHorizontalTicks; i++) {
            String label = this.solutionTimes.size() / nHorizontalTicks * (i + 1) + "";
            FontMetrics fontMetrics = g2.getFontMetrics();
            int width = fontMetrics.stringWidth(label);
            int height = fontMetrics.getAscent();
            int x = (int) (wBase + (i + 0.5) * (getWidth() - wBase) / nHorizontalTicks - width / 2);
            int y = getHeight() - (hBase - height) / 2;

            g2.drawString(label, x, y);
        }

        // draw points
        int nBins = getWidth() - wBase;

        ArrayList<ArrayList<Long>> bins = new ArrayList<ArrayList<Long>>(this.solutionTimes.size());
        for (int i = 0; i < this.solutionTimes.size(); i++) {
            bins.add(new ArrayList<Long>());
        }
        for (int i = 0; i < this.solutionTimes.size(); i++) {
            bins.get(this.solutionTimes.size() - (i + 1)).add(this.solutionTimes.get(i));
        }

        for (int i = 0; i < this.solutionTimes.size(); i++) {
            if (bins.get(i).size() > 0) {
                long mean = 0;
                for (long time : bins.get(i)) {
                    mean += time;
                }
                mean /= bins.get(i).size();

                if (mean >= this.solutionIntervalStart && mean < this.solutionIntervalEnd) {
                    int x = (int) (wBase + ((double) nBins / (double) this.solutionTimes.size()) * (i + 1));
                    int y = (int) (getHeight() - hBase - (getHeight() - hBase) * (mean - this.solutionIntervalStart) / (this.solutionIntervalEnd - this.solutionIntervalStart));

                    g2.fillRect(x - 1, y - 1, 3, 3);
                }
            }
        }
    }
Have a nice day,
JohnZoidberg
 
How do I get this as a program on my computer, like one that I don't need internet to run? I'm not good with stuff like this, please help me out. Thanks.

If you have Java (find out here) you should be able to just click on the link next to download on the original post, press Save File, find it on your computer and double-click on it.
If you don't have Java, download and install Java and then follow the above instructions.
 
I need help downloading PrismaPuzzleTimer on my Mac. Can you please send me a link that works with the OS on my Mac? Kind Regards.
 
I am having trouble with this timer on windows 8, every time I attempt to open it, it opens in notepad and either freezes or has a bunch of nonsense in the notepad. Anyone know how to make it work on windows 8?
I am on windows 8. First of all install Java. I am guessing you dont have java. Then reboot and then try opening it again! If it dosent open, try "Open With" and there select java!
Java link: https://www.java.com/en/download/
 
Back
Top