This content has been marked as final. Show 4 replies
Among the samples I can see that it has been implemented, but not how.
To be more specific, this is my working SQL:
select null link, ID resource_id, TASK_NAME resource_name, PARENT_ID parent_id, START_DATE actual_start, END_DATE actual_end
Now, if I add another column to the statement I get a yellow error message telling that the statement is not valid.
So this is part one of my question. How to add the new value if not providing another column to the graph?
Part two will be how to use the added column to set color of the bar.
I have seen some XML samples, but I can't see the link betw SQL and XML howand where to implement it.
Edited by: perforsgren on May 9, 2013 5:46 PM
You mention "+Among the samples I can see that it has been implemented, but not how.+" - in the Information region below the chart that Tony referred to (https://apex.oracle.com/pls/apex/f?p=36648:50) that I've stated the following:
"The elements of the Timeline region have been customized via the Chart Attributes page, using the following settings: *Custom Colors*: #000000,#00FF00,#0033FF"
So that's how I applied custom colours to that particular chart. However, that declarative option won't meet your requirements, where the colours you wish to apply are dependent on data not included in the chart series query. You mention "+Now, if I add another column to the statement I get a yellow error message telling that the statement is not valid.+". It is not possible to simply add an additional column to the chart series query. Each supported chart type expects the associated chart series query to use specific syntax - see About Creating SQL Queries for Charts in Chapter 10 of the APEX User's Guide, http://docs.oracle.com/cd/E37097_01/doc/doc.42/e35125/bldapp_chrt.htm#BCEIJJID.
So to answer your question "+How to add the new value if not providing another column to the graph?+", if you wish to customise your chart to that extent, then you will need to use custom XML. Depending on what exactly you're trying to achieve, this may require the generation of custom data for your chart. If you edit your chart, and take a look at the Custom XML region, you'll notice a substitution string, #DATA#, towards the end of the XML. When a chart is rendered, we use the chart series query to generate the necessary XML to represent the data on the chart, replacing the string #DATA# with the actual XML. The format of the data XML generated for gantt charts uses a bar style called "defaultStyle", and this handles the default appearance of the bars in the timeline region e.g.
You'll see that the 'style="defaultStyle" ' attribute of the data corresponds to a segment of XML outlining what that style is e.g.
<period resource_id="1" start="2009.03.21 00.00.00" end="2009.09.21 00.00.00" style="defaultStyle"/>
Now take a look at the Bar Style in Resource Project example in the AnyChart online documentation http://www.anychart.com/products/anygantt/docs/users-guide/bar-style.html#bar-style-application-resource-project. In that particular example, a number of different bar styles are used i.e.
If you need to add a different bar style to particular rows of data on your chart, then you'll need to add new bar style XML for each colour you wish to use in the Custom XML on the Chart Attributes page, and then you'll also need to generate the data XML yourself, applying the necessary bar style to the relevant row of data. I've got an example of how custom data can be generated for a Resource Gantt here e.g. https://apex.oracle.com/pls/apex/f?p=36648:73 but keep in mind that particular example doesn't demo adding different styles to the data...but it can certainly give you an idea of what's entailed in the generation of custom data for your chart.
<periods> <period resource_id="server_1" start="2008.07.07" end="2008.07.8" style="Working" /> <period resource_id="server_1" start="2008.07.8" end="2008.07.12" style="Maintance" />
I hope this helps.
I see the overall picture now.
My original intention was to have a separate color for the parent, and another color for the children.
The information is oriented in such a way that this would make the chart easy to read and understand, not to mention that a collapsed node would be easy to detect.
I'll try to do something in the direction you explained.
Many thanks for an excellent explanation.