@@ -0,0 +1,1906 @@
+package com.bsi.tools;%0D%0A%0D%0Aimport org.apache.commons.lang.math.RandomUtils;%0D%0A%0D%0Aimport java.util.ArrayList;%0D%0Aimport java.util.List;%0D%0A%0D%0A/**%0D%0A * Created by gzhang on 3/18/2016.%0D%0A */%0D%0Apublic class AsciiChart %7B%0D%0A    public final static char BLANK=' ';%0D%0A    public final static char BLOCK='*';%0D%0A    public final static int H=50;%0D%0A    public final static int W=50;%0D%0A    public final static float scale=1.0f;%0D%0A%0D%0A    class Bar %7B%0D%0A        String name;%0D%0A        String info;%0D%0A        int x;%0D%0A        int y;%0D%0A        int width;%0D%0A        int height;%0D%0A%0D%0A        public Bar(String name, String info, int x, int y, int width, int height) %7B%0D%0A            this.name = name;%0D%0A            this.info = info;%0D%0A            this.x = x;%0D%0A            this.y = y;%0D%0A            this.width = width;%0D%0A            this.height = height;%0D%0A        %7D%0D%0A    %7D%0D%0A%0D%0A    public static void draw(List%3CBar%3E list)%7B%0D%0A        char%5B%5D%5B%5D matrix=new char%5BH%5D%5BW%5D;%0D%0A        int n=matrix.length;%0D%0A        int m=matrix%5B0%5D.length;%0D%0A        for(Bar b:list)%7B%0D%0A            for(int j=b.y;j%3Cb.y+b.height;j++)%7B%0D%0A                for(int i=b.x;i%3Cb.x+b.width;i++)%7B%0D%0A                    matrix%5BH-1-j%5D%5Bi%5D=BLOCK;%0D%0A                %7D%0D%0A            %7D%0D%0A        %7D%0D%0A        print(matrix);%0D%0A    %7D%0D%0A%0D%0A    public static void print(char%5B%5D%5B%5D matrix)%7B%0D%0A        int n=matrix.length;%0D%0A        int m=matrix%5B0%5D.length;%0D%0A        for(int i=0;i%3Cn;i++)%7B%0D%0A            for(int j=0;j%3Cm;j++)%7B%0D%0A                if(matrix%5Bi%5D%5Bj%5D=='%5C0')%7B%0D%0A                    System.out.print(BLANK);%0D%0A                %7Delse%7B%0D%0A                    System.out.print(matrix%5Bi%5D%5Bj%5D);%0D%0A                %7D%0D%0A            %7D%0D%0A            System.out.println();%0D%0A        %7D%0D%0A    %7D%0D%0A%0D%0A%0D%0A    public static void main(String args%5B%5D) %7B%0D%0A        List%3CBar%3E data=new ArrayList%3C%3E();%0D%0A        for(int i=0;i%3C25;i+=3)%7B%0D%0A            data.add(new AsciiChart().new Bar(%221%22,%221%22,i,0,1,RandomUtils.nextInt(30)));%0D%0A        %7D%0D%0A        draw(data);%0D%0A    %7D%0D%0A%7D%0D%0A

Add files via upload