Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Set X axis starting point value
RepBIRT
<p>Kindly share the steps to set x axis starting point as 3 days previous of current date. </p><p> </p><p>For example,</p><p> </p><p>Today is Sunday</p><p>The starting value should be Thursday</p>
Find more posts tagged with
Comments
BRM
<p>What does your data look like? One way to do this would be to union your dataset with a data point that begins where you want.</p>
RepBIRT
<p>The data will contain details for a day or two or three. Irrespective of the data availability, the x axis should start with three days prior to the current day.</p>
GLO_FR
<p>Hi,</p><p> </p><p>Create (or not) a parameter with your starting date (in this code <strong>pDate</strong>)</p><p>Give a name to your chart (in this code <strong>myChart</strong>)</p><p> </p><p>Paste this script in the beforeFactory of your report and it should work</p><pre class="_prettyXprint _lang-js">importPackage(Packages.org.eclipse.birt.chart.model);importPackage(Packages.org.eclipse.birt.chart.model.data.impl);rptDesignHandle = reportContext.getReportRunnable().designHandle.getDesignHandle();chart = rptDesignHandle.findElement("myChart");item = chart.getReportItem();cm = item.getProperty("chart.instance");xAxis = cm.getBaseAxes()[0];pDate = params["pDate"].valuepDate.setDate(pDate.getDate() - 3);myMinDate = new Date((pDate.getMonth() + 1) + "/" + pDate.getDate() + "/" + (pDate.getYear() + 1900));xAxis.getScale().setMin(DateTimeDataElementImpl.create(myMinDate));</pre><p>If you want to use the current date instead of a parameter, just write</p><p>pDate = new Date();</p>