1

i m using jfreechart to draw a graph about a logger of operations in a computer.

ex: 1:2012/09/39/28 06:55:37 8 S 0x1c0c762 Terminal --geometry=134x35 --display :0.0 --role=Terminal-0x10591b0-16869-1343137248 --show-menubar --show-borders --hide-toolbars --working-directory /home/termier "Terminal", "Terminal" "Terminal - termier@akagi: ~" 2:2012/09/39/28 06:55:41 8 S 0x1600313 /usr/lib/xfce4/notifyd/xfce4-notifyd "xfce4-notifyd", "Xfce4-notifyd" "xfce4-notifyd"

for now , i can draw every point just like (2012/09/39/28 06:55:37,Terminal),scilicet: x-axis is 2012/09/39/28 06:55:37 , Y-axis is: Terminal (i use 1 to present Terminal ,as for other commands just like Terminal... 2:/usr/lib/xfce4/notifyd/xfce4-notifyd ,etc...)

but what i need is draw a block ,like:

terminal 1: _________S||||||

/usr/lib/xfce4/notifyd/xfce4-notifyd2:______________S||||||

com 3: _____S||||| (S:start ,eg: 2000/12/12 09:22:10 start) ..... (when the first command end, another one will be start ,i just can get the start, it means that the post command is the end time of the previous command)

but not: 1: S 2: S 3: S

here some codes to you.

private XYDataset createDataset() {

    Calendar precal;
    Calendar postcal;

    this.flags = modelfocus.getListflag();
    commands = modelfocus.getListCommand();
    DateFormat formatedate = new SimpleDateFormat("yyyy/MM/ww/dd HH:mm:ss");
    precal = Calendar.getInstance();
    postcal = Calendar.getInstance();

    for (int i = 0; i < countCom; i++) {
        this.series[i] = new TimeSeries(commands.get(i));
    }

    for (Focus listTxt : modelfocus.getList()) {
        try {
            Date d = new Date();
            d = formatedate.parse(listTxt.date2String());
            System.out.println(d);
            precal.setTime(d);
            //postcal.setTime();
        } catch (ParseException e) {
            System.out.println("Can't change this date");
            e.printStackTrace();
        }
        String eachCmd = listTxt.getCommand();
        for (int i = 0; i < countCom; i++) {
            if (eachCmd == commands.get(i)) {
                series[i].addOrUpdate(new Second(precal.getTime()),
                        flags.get(i));
            }
        }

    }
    TimeSeriesCollection dataset = new TimeSeriesCollection();
    for (int i = 0; i < countCom; i++) {
        dataset.addSeries(this.series[i]);
    }
    return dataset;
}

Please can someone give help to solve this problem, thank you very much.

Hovercraft Full Of Eels
  • 283,665
  • 25
  • 256
  • 373
WUJ
  • 1,663
  • 3
  • 15
  • 21

1 Answers1

1

As shown in this example, you can change the Shape used to render the values of a time series. A Rectangle is shown below.

r.setSeriesShape(0, new Rectangle(-4, -4, 9, 9));

image

Community
  • 1
  • 1
trashgod
  • 203,806
  • 29
  • 246
  • 1,045
  • ok . i change the way to slove my problem. i m using gantt chart. but your information is still helpful to me. thanks ^^ – WUJ Mar 05 '13 at 14:23