format xAxis labels in chartdirector

(2 posts) (2 voices)

Tags:

No tags yet.

  1. Tim, Member

    Hi,

    I'm trying to format the xAxis labels in a StackedColumn chart using chartdirector, but all attempts seem to be ignored. The label values are datetimes coming from a MSSQL 2005 DB.

    I tried some variants of the following options:
    select 'dbr.chart.options', 'chartdirector','$c->xAxis->setLabelFormat("{value|dd.mm.yyyy}");';
    select 'dbr.colstyle', 'InsertDate', '<*color=FF0000*>{value|dd.mm.yyyy}';
    select 'dbr.colstyle', 'InsertDate', '[color: green]';

    The result is always the same default date format, including time values without color formatting applied. On the yAxis this seems to be working better.
    My ultimate goal would be to use chartdirectors setMultiFormat() function to highlight start of day values.

    Is there any chance this can be done?

    Kind Regards,
    Tim

  2. myDBR Team, Key Master

    Tim,
    the x-axis is formatted with user's dateformat if the column is a date (datetime/date). As MS SQL Server 2005 does not have date-datatype (only datetime), you need to tell myDBR that you want to treat datetime as date. To do this use following formatting when you select a datetime column:

    select mydatetime as 'date_column:type=date'...

    (Same applies if you are using FreeTDS which does not know about the date-datatype neither)

    As for the coloring, if you define same color for both axis, you can use

    select 'dbr.chart.options', 'axis_color', '0x00FF00';

    If you just want to color the x-axis, you need to use ChartDirector native commands:

    select 'dbr.chart.options', 'chartdirector', '$c->xAxis->setLabelStyle( "", 8, 0xFF0000 );';

    --
    myDBR Team


Reply

You must log in to post.