<p>Hello,</p>
<p> </p>
<p>I'm trying to use a custom FormatSpecifier on the x-axis of a chart, but it seems when the report is rendered, my custom format specifier has been replaced with FormatSpecifierImpl.</p>
<p> </p>
<p>When creating the report I do this:</p>
<pre class="_prettyXprint">
Axis xAxisPrimary = chart.getPrimaryBaseAxes()[0];
xAxisPrimary.setFormatSpecifier(new MyFormatSpecifier());</pre>
<p>Now in the event handler for the chart I do something like this:</p>
<p> </p>
<div>
<pre class="_prettyXprint">
@Override
public void beforeDrawAxisLabel(Axis axis, Label label, IChartScriptContext icsc)
{
FormatSpecifier fmt = axis.getFormatSpecifier();
if (fmt instanceof MyFormatSpecifier){
MyFormatSpecifier axisFmt = (MyFormatSpecifier)fmt;
label.getCaption().setValue(axisFmt.format(label.getCaption().getValue()));
}
}</pre>
</div>
<div>The problem is, fmt never comes back as an instance of MyFormatSpecifier. Instead it's always just FormatSpecifierImpl. If I remove the code that sets MyFormatSpecifier, it always returns null as the format specifier, which it should. Maybe there is another way I should be doing it? Are there custom properties I can set in an axis that I can look up so I know how to format the values before they're drawn? If I can do that instead, then once I get to the chart handler I'll know how to format the data for the axis and I can not user a format specifier.</div>
<div> </div>
<div>Thanks.</div>
<div> </div>