0

I have below mentioned 4 xml files in which i have state & key & BuildDate. I need to represent the "state" information of "key" in a graph based on BuildDate.

The x-axis should have past 6 days (w.r.t current date. suppose today is 7th Sept then the entry should be from 1st to 6th Sept). If there is an entry for the corresponding date in BuildDate feild then the state should be displayed as red or green (Failed - red, Success - green). Otherwise black should be displayed.

I am mainly struggling in adding the value & displaying according to date.

How can i do this via jfreechart? (StackedBarChart?)

        inupt_1.xml:

        <?xml version="1.0" encoding="UTF-8"?>
        <results>
        <result id="1" number="10" lifeCycleState="Finished" state="Failed" key="PLAN-A" BuildDate="2014 Sept 1">
        </result>
        <result id="2" number="20" lifeCycleState="Finished" state="Success" key="PLAN-A" BuildDate="2014 Sept 2">
        </result>
        <result id="3" number="30" lifeCycleState="Finished" state="Failed" key="PLAN-A" BuildDate="2014 Sept 3">
        </result>
        <result id="4" number="40" lifeCycleState="Finished" state="Success" key="PLAN-A" BuildDate="2014 Sept 4">
        </result>
        <result id="5" number="50" lifeCycleState="Finished" state="Failed" key="PLAN-A" BuildDate="2014 Sept 5">
        </result>
        <result id="6" number="60" lifeCycleState="Finished" state="Failed" key="PLAN-A" BuildDate="2014 Sept 7">
        </result>
        </results>


       inupt_2.xml:

        <?xml version="1.0" encoding="UTF-8"?>
        <results>
        <result id="1" number="10" lifeCycleState="Finished" state="Success" key="PLAN-B" BuildDate="2014 Sept 1">
        </result>
        <result id="2" number="20" lifeCycleState="Finished" state="Failed" key="PLAN-B" BuildDate="2014 Sept 2">
        </result>
        <result id="3" number="30" lifeCycleState="Finished" state="Success" key="PLAN-B" BuildDate="2014 Sept 4">
        </result>
        <result id="4" number="40" lifeCycleState="Finished" state="Success" key="PLAN-B" BuildDate="2014 Sept 5">
        </result>
        <result id="5" number="50" lifeCycleState="Finished" state="Failed" key="PLAN-B" BuildDate="2014 Sept 6">
        </result>
        <result id="6" number="60" lifeCycleState="Finished" state="Failed" key="PLAN-B" BuildDate="2014 Sept 7">
        </result>
        </results>


        inupt_3.xml:

        <?xml version="1.0" encoding="UTF-8"?>
        <results>
        <result id="1" number="10" lifeCycleState="Finished" state="Failed" key="PLAN-C" BuildDate="2014 Sept 1">
        </result>
        <result id="2" number="20" lifeCycleState="Finished" state="Success" key="PLAN-C" BuildDate="2014 Sept 3">
        </result>
        <result id="3" number="30" lifeCycleState="Finished" state="Failed" key="PLAN-C" BuildDate="2014 Sept 4">
        </result>
        <result id="4" number="40" lifeCycleState="Finished" state="Success" key="PLAN-C" BuildDate="2014 Sept 5">
        </result>
        <result id="5" number="50" lifeCycleState="Finished" state="Success" key="PLAN-C" BuildDate="2014 Sept 6">
        </result>
        <result id="6" number="60" lifeCycleState="Finished" state="Failed" key="PLAN-C" BuildDate="2014 Sept 7">
        </result>
        </results>

        inupt_4.xml:

        <?xml version="1.0" encoding="UTF-8"?>
        <results>
        <result id="1" number="10" lifeCycleState="Finished" state="Failed" key="PLAN-D" BuildDate="2014 Sept 1">
        </result>
        <result id="2" number="20" lifeCycleState="Finished" state="Success" key="PLAN-D" BuildDate="2014 Sept 2">
        </result>
        <result id="3" number="30" lifeCycleState="Finished" state="Success" key="PLAN-D" BuildDate="2014 Sept 4">
        </result>
        <result id="4" number="40" lifeCycleState="Finished" state="Success" key="PLAN-D" BuildDate="2014 Sept 5">
        </result>
        <result id="6" number="60" lifeCycleState="Finished" state="Failed" key="PLAN-D" BuildDate="2014 Sept 7">
        </result>
        </results>

Graph:

enter image description here

DJClayworth
  • 26,349
  • 9
  • 53
  • 79
SS Hegde
  • 729
  • 2
  • 14
  • 33
  • Maybe [this](http://stackoverflow.com/q/7999587/230513) or [this](http://stackoverflow.com/a/8949913/230513)? – trashgod Sep 10 '14 at 10:46
  • @trashgod: But how do i fit the item according to date? how should i make the bar as black if there is no match for that particular date? – SS Hegde Sep 10 '14 at 14:20
  • Both examples override `getItemPaint()` to supplant the `DefaultDrawingSupplier`. – trashgod Sep 10 '14 at 19:41
  • Please edit your question to include a [complete example](http://stackoverflow.com/help/mcve) that shows your current approach. – trashgod Sep 13 '14 at 08:26
  • @trashgod: Please have a look. I have asked separately in this. http://stackoverflow.com/questions/25873131/jfreechart-setting-the-bar-column-color-based-on-the-state-in-stackedbarchart. – SS Hegde Sep 16 '14 at 15:45

0 Answers0