Use variables in dbr.chart x and y size?

(5 posts) (2 voices)

Tags:

  1. duane, Member

    Hi again,

    I have a series of procedures which generate the code for multiple similar charts (using a loop). Some of these charts have a small number of data points (1-4) and some have a large number (5-20+). The pre-set sizing of the x and y dimensions of a chart obviously make these charts either appear oversized or squashed.

    I've tried to set a variable using @chart_width in the procedure and then using @char_width in the code as the x width value, but it doesn't seem to work. Do you know of a way to use variables in the xWidth value of dbr.chart?

  2. myDBR Team, Key Master

    Dynamically adjusted chart sizes can be done with variables. If you'll show the relevant code, it should be easy to fix.

    --
    myDBR Team

  3. duane, Member

    Hi - I've figured it out - turns out it was a problem with my code.

    Just for reference, what I was trying to do (and did) was to find a way to set the height and width of the chart-area minus the labels so that they all share a similar width, date-point size (e.g. bar height) (and scale) BETWEEN the charts.

    So what I have done is
    1) Set the scale for all similar charts to be the same (as per normal method)
    2) calculate max label length (character count) and multiply by 5 (since 1 character is about 5 pixels wide)
    3) Add a fixed size to the label-pixel count (e.g. 300) which becomes the width of the chart-area (excluding labels)
    4) calculated the number of data-points for the chart, multiplied by 20 (so each data point is about 20 pixels in size for a bar chart)
    5) Add a fixed amount to cover the header and footer of the chart. For a bar chart, 60 pixels seemed a good amount.

    I calculated those values and then use the variables in place of the hard coded numbers...and it seems to have done the trick...it is just a bit code-heavy when it would be nice to set these sizes directly :-)

    The reason for doing this is that for usability purposes, having multiple graphs of the same type having the same dimensions of the graph and data-points makes them easier to read and compare.

  4. myDBR Team, Key Master

    Instead of trying to figure out optimal size of the chart based on chart data, myDBR does figure out what is the optimal layout for chart with given data with given size.

    Optimal chart size is a matter of preference and depends a lot with the data and the actual context where the chart is used.

    --
    myDBR Team

  5. duane, Member

    I think MyDBR does a great job of determining optimal size on a chart-by-chart basis.

    However between charts the sizes can vary considerably (at least in my experience so far). So having consistency between charts which are meant to help compare the same thing is something I (and I suspect others) need as well. Combining a lot of data points in one chart would be overwhelming.

    (It could always be that I'm doing something wrong not to have this in the first place!)


Reply

You must log in to post.