Label / Showvalues formatting

(8 posts) (2 voices)

Tags:

No tags yet.

  1. jjr, Member

    Hi there,

    I am having an issue formatting the values shown using the "showvalues" option.

    Using the dbr.colstyle option, I can format the values using printf parameters, but I can't seem to use css at all. I have tried using css on it's own and also using the dbr.colclass option, but none of these seem to work.

    I would be very grateful for any help identifying where I've made a mistake in my code/use of the options or if this is not supported in MyDBR.

    Some demo code that produces this issue is:

    select 'dbr.chart', 'Column', 'Test Labels';
    select 'dbr.chart.options', 'showvalues', 'total';
    select 'dbr.colstyle', 'b', '[color:red]US$%.1fm';

    SELECT "1" AS `a`,
    "2" AS `b`;

    Thanks in advance for any help.
    Justin

  2. myDBR Team, Key Master

    Justin,
    the ChartDirector does not use CSS definitions, but you can use ChartDirector Mark Up Language with dbr.colstyle with charts.

    select 'dbr.chart', 'Column', 'Test Labels';
    select 'dbr.chart.options', 'showvalues', 'total';
    select 'dbr.colstyle', 'b', '<*color=FF0000*>US $%.1fm'; select "1" AS 'a', 2 AS 'b';

    --
    myDBR Team

  3. jjr, Member

    Perfect. And thanks so much for the quick response.
    I suggest that this is made clearer in the documentation as I can't see any reference to it. Thanks.

  4. jjr, Member

    Hi,

    I am having a knock-on issue with this.
    Once I specify the colstyle using ChartDirector Markup, this impacts on the MyDBR tooltip format.

    If you add the following code to the above:

    select 'dbr.chart.options', 'tooltip', '[b]';

    How do I get the tooltip to display the original column format? I can't seem to figure out how to do this.

    Thanks,

    Justin

  5. jjr, Member

    For further info: what I'm actually seeing is the Markup code for ChartDirector in my tooltip, e.g.:
    <*size=10*>
    Is there an issue/bug with using these two functionalities together or am I doing something wrong?
    Thanks.

  6. myDBR Team, Key Master

    If you want both custom labels and custom tooltip, you can select the same data column twice for the tooltip:

    select 'dbr.chart', 'Column', 'Test Labels';
    select 'dbr.chart.options', 'showvalues', 'total';
    select 'dbr.colstyle', 'y', '<*color=FF0000*>US $%.1fm';
    select 'dbr.chart.options', 'tooltip', '[y_tooltip]'; select x, y, y as 'y_tooltip'
    from data;

    ,alternatively, if you just want to set the label color, you can use 'label_font_color'-option:

    select 'dbr.chart', 'Column', 'Test Labels';
    select 'dbr.chart.options', 'showvalues', 'total';
    select 'dbr.colstyle', 'b', 'US $%.1fm';
    select 'dbr.chart.options', 'tooltip', '[b]';
    select 'dbr.chart.options', 'label_font_color', '0xFF0000'; select "1" as 'a', "2" as 'b';

    --
    myDBR Team

  7. jjr, Member

    Hi, thanks for the reply.
    Yes it's not just the color, so I'll use the first example.
    Not quite perfect as my columns are calculations so there might be a minor performance hit, but more than happy there is a way to do it - Thanks.

  8. myDBR Team, Key Master

    Not likely that there will really be any performance hit as number of rows usually for a chart will be limited and hard work in the database is already done when rows are fetched (unless you serialize the queries by using functions that fetch data).

    The thing to consider is the maintainability of your code. If you have a complex column calculation, you usually do not want to duplicate that complexity to another column. For this you can use a query against your result set:

    select x, y, y as 'y_tooltip'
    from (
    select x, complex_y_caclulation as 'y'
    from data
    ) as q;

    --
    myDBR Team


Reply

You must log in to post.