Where are the Chartdirector Examples please

(6 posts) (2 voices)
  1. acormack, Member

    Apart from a brief mention on the Docs Commands/Charts page I can see very little mentioned about using chartdirector.

    For instance how would I implement this Chartdirector AngularMeter chart in MyDbr (premium)

    Thanks in advance.

    require_once("../lib/phpchartdir.php");

    # The value to display on the meter $value = 27.48;

    # Create an AngularMeter object of size 200 x 115 pixels, with silver background # color, black border, 2 pixel 3D border border and rounded corners $m = new AngularMeter(200, 115, silverColor(), 0x000000, 2); $m->setRoundedFrame();

    # Set the meter center at (100, 100), with radius 85 pixels, and span from -90 to +90 # degress (semi-circle) $m->setMeter(100, 100, 85, -90, 90);

    # Meter scale is 0 - 100, with major tick every 20 units, minor tick every 10 units, # and micro tick every 5 units $m->setScale(0, 100, 20, 10, 5);

    # Set 0 - 60 as green (66FF66) zone $m->addZone(0, 60, 0, 85, 0x66ff66);

    # Set 60 - 80 as yellow (FFFF33) zone $m->addZone(60, 80, 0, 85, 0xffff33);

    # Set 80 - 100 as red (FF6666) zone $m->addZone(80, 100, 0, 85, 0xff6666);

    # Add a text label centered at (100, 60) with 12 pts Arial Bold font $m->addText(100, 60, "PSI", "arialbd.ttf", 12, TextColor, Center);

    # Add a text box at the top right corner of the meter showing the value formatted to # 2 decimal places, using white text on a black background, and with 1 pixel 3D # depressed border $textBoxObj = $m->addText(156, 8, $m->formatValue($value, "2"), "arial.ttf", 8, 0xffffff); $textBoxObj->setBackground(0x000000, 0, -1);

    # Add a semi-transparent blue (40666699) pointer with black border at the specified # value $m->addPointer($value, 0x40666699, 0x000000);

    # Output the chart header("Content-type: image/png"); print($m->makeChart2(PNG));

  2. myDBR Team, Key Master

    Hi,
    myDBR uses ChartDirector ("image charts", you can choose PNG/SVG as output). in similar ways it uses Flash based charts. When you turn on ChartDirector option, all your charts will be drawn using ChartDirector.

    Image charts offer much greater variation both in charts and options it supports. You can even use native ChartDirector code if needed.

    To take a look at the charts available when using Image charts, take a look at some demo charts:

    Chart examples in myDBR demo

    The semicircle chart is a variation of basic meter chart.

    --
    myDBR Team

  3. acormack, Member

    Thanks for the quick reply. But I still cannot see how I tell MyDbr that I want specific chartdirector commands e.g.:

    $m = new AngularMeter(200, 115, silverColor(), 0x000000, 2); $m->setRoundedFrame();

    # Set the meter center at (100, 100), with radius 85 pixels, and span from -90 to +90 # degress (semi-circle) $m->setMeter(100, 100, 85, -90, 90);

  4. myDBR Team, Key Master

    Hi,
    did you look at the demo? If you click the "Show how the report is done" button in bottom, you will see that the semicircle drawn in the demo is created like this:

    select 'dbr.chart', 'meter', 'Meter', 600 as 'x', 240 as 'y', 160 as 'radius',
    220 as 'yCenter',
    -90 as 'Start angle',
    90 as 'End angle',
    30 as 'green',
    70 as 'yellow',
    100 as 'red';

    select 78;

    The semicircle chart is also featured in myDBR documentation:

    The only time you need to use native ChartDirector commands is when you want to use ChartDirector option that has no command reference in myDBR.

    --
    myDBR Team

  5. acormack, Member

    Yes thanks I saw this example. Although it only seems to work with data between 0 and 100.

    What I am trying to find out is how I use native chartdirector commands to render an angular meter looking exactly as the example on their site Wide Angular Meter.

    Please tell me how I can issue the native chartdirector commands that I listed in my original post.

  6. myDBR Team, Key Master

    Hi,
    The 'red' parameter in myDBR's meter chart defines the upper limit of the chart value, it does not have to be 100.

    The examples in ChartDirector's Wide Angular Meters are in myDBR 'meter charts'. You can pass native ChartDirector code for the formatting using the select 'dbr.chart.options','chartdirector' command. See documentation for "ChartDirector native options".

    Basically if you wish to replicate the ChartDirector's Wide Angular Meters demo, you will create first a myDBR meter chart and then format the chart using dbr.chart.options by passing required ChartDirector code.

    Another alternative, is to use myDBR eChart extension which allows for you to create a your own chart type and utilize ChartDirector for that. See the eChart code at user/extensions/echart.

    --
    myDBR Team


Reply

You must log in to post.