All Apps and Add-ons

How to use a Gantt Chart

harshal_chakran
Builder

Hi, I have a CSV file with start_time and end_time and the difference.

Parameters  START_TIME  END_TIME    DIFFERENCE IN MINS
param1        1425485370    1425490179  80.15
param2        1425525368    1425528124  45.93
param3        1425462452    1425464795  39.05
param4        1425619254    1425620315  17.68

Here the start and end time both are in epoch format.
I want to built a Gantt chart, with Y axis as "Parameters" and X-axis as time over a day.
I have taken help from the Gantt Chart visualization app , but couldn't get through.
I have altered the source code as follows:

<form script="autodiscover.js">
    <label>Gantt Chart demo</label>

    <row>
        <html>
            <h2>Gantt Chart demo</h2>
            <div id="demo-search"
                 class="splunk-manager"
                 data-require="splunkjs/mvc/searchmanager"
                 data-options='{
                    "search": { "type": "token_safe", "value": "|inputcsv myfile.csv |table Parameters, START_TIME END_TIME" },
                    "earliest_time": { "type": "token_safe", "value": "-4h@m" },
                    "latest_time": { "type": "token_safe", "value": "now" },
                    "cancelOnUnload": true,
                    "preview": true
                 }'>
            </div>

            <div id="demo-view"
                 class="splunk-view"
                 data-require="app/gantt/components/gantt/gantt"
                 data-options='{
                    "managerid": "demo-search",
                    "startField": "START_TIME",
                    "endField": "END_TIME",
                    "categoryLabel": "Parameters",
                    "categoryField": "Parameters",
                 }'>
            </div>
        </html>
    </row>
</form>

Please Help...!!

0 Karma
1 Solution

alexiri
Communicator

It might also be that there's an extra comma after "categoryField": "Parameters". Splunk's JSON parser is very picky about that sort of thing.

View solution in original post

alexiri
Communicator

It might also be that there's an extra comma after "categoryField": "Parameters". Splunk's JSON parser is very picky about that sort of thing.

harshal_chakran
Builder

Yes, that last comma was the actual problem.
Thanks alexiri. It worked

0 Karma

sssignals
Path Finder

Hi harshal_chakranarayan,

I faced a similar problem as you. Did your above example work? The gantt example makes use of events and transaction which is not directly applicable. I am trying to get an example like yours to work.

Thanks.

0 Karma

harshal_chakran
Builder

I have changed the earlier and latest according to my data timestamp.

0 Karma

alexiri
Communicator

What exactly isn't working?

One thing that jumps out while looking at your code is that the categoryField should be Parameters, not Parameter.

0 Karma

harshal_chakran
Builder

Hi,
Sorry, It was typing mistake, its "Parameters" only
I am using the source code of the Gantt Chart visualization app. There I have inserted my search query which I mentioned above. And made the changes as per my understanding.
When I save the XML Source Code, no result is displayed.

0 Karma

alexiri
Communicator

Could it be because of the earliest_time? Perhaps there's actually no data in the last 4 hours. The sample data you sent is several days old, but I don't know if you're working with more data than that...

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...