Multi-Series Line Double-Y

(13 posts) (6 voices)
  1. sf_baker, Member

    Is it possible to create a chart that is a multi-series line with a double-Y axis?

  2. myDBR Team, Key Master

    You could do one with ChartDirector commands. If you are planning to have two Y-axis with different scale, please note that such a chart might be hard to understand.

    --
    myDBR Team

  3. antonymo, Blocked

    Any example for doing two series of line with double-Y axis? Also I am looking for how to put Second(right) Y-axis name. I can only put first(left) Y-axis name by using

    Select 'dbr.chart.options', 'axis', 'X-Axis Name', 'First Y-Axis Name';

  4. myDBR Team, Key Master

    You can use ChartDirector command to do that:

    select 'dbr.chart.options', 'chartdirector', '$c->yAxis2->setTitle("yAxis2 title");';

    --
    myDBR Team

  5. dharkness, Member

    I also need to do this. I see that you can add a title for the second (right) y-axis by adding it to the same command.

    select 'dbr.chart.options', 'axis', 'X-Axis Name', 'First Y-Axis Name', 'Second Y-Axis Name';

    However, I need to add a second Y scale as well. While it may seem confusing at first, we want to chart units sold with revenue and see how well the lines track each other. Without a separate scale, the units sold line is barely noticeable since it's squished nearly to the x-axis.

  6. myDBR Team, Key Master

    We've added MSLineDY-chart type into the latest build.

    --
    myDBR Team

  7. dharkness, Member

    Great! I see MSColumnLineDY in the list and assume MSLineDY is coming to the documentation page soon, but I don't see anything about specifying which lines should be graphed to the second y-axis.

    Do you have a sample you could post, please?

  8. myDBR Team, Key Master

    The first SeriesName appearing in data will be the left Y, the second will be the right Y.

    select 'dbr.chart.options', 'axis', 'X-Axis Name', 'First Y-Axis Name', 'Second Y-Axis Name';
    
    select 'dbr.chart', 'MSlineDY';
    
    select Category, SeriesName, SeriesValue
    from mydata;

    --
    myDBR Team

  9. pasi_dd, Member

    Is there a way to specify each line to either of the axis. I have now three lines, one being # of customers (0-3000) and two being percentages (0-1). I would like to have the percentages on their own axis and the # of customers on the other. I have not found any way to do this.

    By default myDBR seems to assign the axis randomly, sometimes after refreshing the page the lines just switch their axis, without any changes being made to the query.

  10. myDBR Team, Key Master

    myDBR will alwats put the last series appearing in the data into the secondary axis. Change in the axis is most likely caused by different data order.

    There is currently no way of specifying the axis by series, but we can take a look at it as is might sometimes be useful.

    --
    myDBR Team

  11. myDBR Team, Key Master

    There is now a chart option 'series_axis' which allows to choose the y-axis per series. Run the updater to get the latest build.

    To use the option:

    // Use first y-axis:
    select 'dbr.chart.options', 'series_axis', 'SeriesName', 1;

    or

    // Use second y-axis:
    select 'dbr.chart.options', 'series_axis', 'SeriesName', 2;

    --
    myDBR Team

  12. dbrGem, Member

    I'm building a report that has the number of people signed up each interval and the percentage change between intervals. The chart is using two y_axis (series_axis) for each data series.
    Two questions:
    1. How do I change the scale for each y_axis.
    For example; the first y_axis will be 0-4000 (how many people) and the second y_axis will be 0-100 (percentage).

    2. I'm getting an error (see below) when I include the series_axis options.
    Fatal error: Call to a member function getImageCoor() on a non-object in /var/www/mydbr/lib/chart2.php on line 1582

    Notes: When the series_axis options are removed the chart displays (see below).

    chart without series_axis:

    Chart Error Code example with series_axis:
    select 'dbr.chart', 'msline', 'Test';
    select 'dbr.chart.options', 'axis', 'How Many', 'Percent';
    select 'dbr.chart.options', 'series_axis', 'How Many', 1;
    select 'dbr.chart.options', 'series_axis', 'Percent', 2;
    select Interv, series, value from
    (
    select Inter as 'Interv', 'How Many' as 'series', HM as 'value' from dbr.temp_table_chart_ans_sub as t1 where HM > 0
    union
    select Inter as 'Interv', 'Percent' as 'series', p_change as 'value' from dbr.temp_table_chart_ans_sub_msline as t2
    ) as t3;

  13. myDBR Team, Key Master

    Use the mslinedy chart instead of msline. The msline has only one y-axis.

    To manually set the scales:

    select 'dbr.chart.options', 'scale', 0, 4000;
    select 'dbr.chart.options', 'chartdirector', '$c->yAxis2->setLinearScale(0, 100);';

    --
    myDBR Team


Reply

You must log in to post.