Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsX-axis labels for chart
https://www.eclipse.org/forums/index.php/mv/msg/237365/720003/#msg_720003
Is this possible. At the moment I have the label at a 45 degree angle but I'm looking for other options. ]]>Olly 2011-08-29T16:38:35-00:00Re: X-axis labels for chart
https://www.eclipse.org/forums/index.php/mv/msg/237365/720080/#msg_720080
Is the x-axis using a date time field? If so why not format the x-axis
labels to only show the hour and use the x-axis title to show the date.
Use some script something like:
xaxistitle = "";
function afterDataSetFilled( series, dataSet, icsc )
{
//org.eclipse.birt.chart.util.CDateTime My test report only had one row
//of data
var mycdatetime = dataSet.getValues()[0];
xaxistitle = mycdatetime.getYear() + "-" + mycdatetime.getMonth() + "-"
+ mycdatetime.getDay();
}
}
On 8/29/2011 12:38 PM, Olly wrote:
> Is there any way programmatically or via the Eclipse plugin to make the x-axis in a line or area chart have a two tiered label for a timestamp. What I mean is I want the x-axis, which is a timestamp from a database, to look like the attached image.
>
> Is this possible. At the moment I have the label at a 45 degree angle but I'm looking for other options.]]>Jason Weathersby2011-08-29T20:06:17-00:00Re: X-axis labels for chart
https://www.eclipse.org/forums/index.php/mv/msg/237365/720501/#msg_720501
Thanks for the quick response. The only problem I can see with this is that the charting may encompass multiple days, so this would have to be reflected in the chart, i.e. 2011-05-05 2011-05-06 2011-05-07 all on the same chart. Thanks for your help. ]]>Olly 2011-08-30T18:02:02-00:00Re: X-axis labels for chart
https://www.eclipse.org/forums/index.php/mv/msg/237365/720570/#msg_720570
example.
Jason
On 8/30/2011 2:02 PM, Olly wrote:
> Jason,
> Thanks for the quick response. The only problem I can see with this is
> that the charting may encompass multiple days, so this would have to be
> reflected in the chart, i.e. 2011-05-05 2011-05-06 2011-05-07 all on the
> same chart. Thanks for your help.]]>Jason Weathersby2011-08-30T20:14:58-00:00Re: X-axis labels for chart
https://www.eclipse.org/forums/index.php/mv/msg/237365/1116652/#msg_1116652
function beforeDrawAxisLabel( axis, label, icsc )
{
importPackage(
Packages.org.eclipse.birt.chart.model.attribute.impl );
importPackage(
Packages.org.eclipse.birt.chart.model.attribute );
if( axis.getType() == AxisType.TEXT_LITERAL ){
var cp =label.getCaption().getValue();
if( cp.substr(0,2) == last ){
label.getCaption().setValue(cp.substr( (cp.length()-2)));
}else{
label.getCaption().setValue(cp.substr( (cp.length()-2))+"\n\r "+cp.substr(0,2));
}
last = cp.substr(0,2);
}
what does label and icsc refer to?
Could not make my code working by resuing above code.]]>rachel s2013-09-25T18:04:06-00:00Re: X-axis labels for chart
https://www.eclipse.org/forums/index.php/mv/msg/237365/1117516/#msg_1117516
/**
* Called before rendering each label on a given Axis.
*
* @param axis
* Axis
* @param label
* Label
* @param icsc
* IChartScriptContext
*/
It's a standard function that allows you to modify the chart. If you select your chart and go to the script area, you'll see a drop down of functions at the top. If you select one, it will add it to the script area. As far as what the rest of the code does, it is checking the first several characters of the text axis (the x-axis) and changing the label value based on a comparison to the previous label value. Hope this helps.]]>Michael Williams2013-09-26T14:26:07-00:00