Skip to content

Combined

  • Type: Multi-series chart combining different chart types
  • Dimensions: X-axis (categories), Y-axis (values), optional second Y-axis
  • Use cases: Compare measures with different scales, show trends with bars, display related metrics together
  • Special features: Supports dual Y-axes (left and right), can mix column, line, spline, and other types
  • Visual: Multiple series with different visualizations overlaid on the same graph

Combined graph

The image shows a combined chart with columns (employees count) on the left Y-axis and spline lines (average age and career length) on the right Y-axis, all sharing the same X-axis (companies).

To create a Combined chart, initialize the graph, add multiple axes (one per scale), and add data series with different chart types.

$olap.addGraph("1", "Employees, Avg Age and Career Length", "[time_month]:[key_company]", "","0");
$olap.addGraphAxis('1', '1', 'Employees','false')
$olap.addGraphAxis('1', '2', 'Avg. years','true','0','80','10')
$olap.addGraphData("1", "1","Employees", "[key_company]", "count(distinct [employee_number])", "column","", "", "");
$olap.addGraphData("1", "2","Age", "[key_company]", "avg([age])", "spline","", "", "")
$olap.addGraphData("1", "2","Career", "[key_company]", "avg([career_length])", "spline","", "", "");

This produces a combined chart with columns showing employee count on the left axis, and spline lines showing average age and career length on the right axis.

Combined charts require multiple Y-axes when measures have different scales. Use opposite: true for the second axis.

Required setup for dual axes:

$olap.addGraphAxis('graph_id', 'axis_id_1', 'Left Axis Label','false')
$olap.addGraphAxis('graph_id', 'axis_id_2', 'Right Axis Label','true','min','max','interval')

Key points:

  • First axis (opposite: false) = left side
  • Second axis (opposite: true) = right side
  • Always set min/max/interval on second axis to prevent scale changes when filtering
  • First axis can auto-scale, but second should be fixed

Example:

$olap.addGraphAxis('1', '1', 'Employees','false')
$olap.addGraphAxis('1', '2', 'Avg. years','true','0','80','10')

Single axis (same scale):

$olap.addGraphAxis('1', '1', 'Amount','false')
// All series use axis_id '1'

Add multiple data series with different chart_type values. Each series references its axis ID.

Syntax for each series:

$olap.addGraphData(
"graph_id",
"axis_id", // Which axis this series uses
"dataseries_label",
"series",
"measure",
"chart_type", // Different types: "column", "spline", "line", etc.
"",
"filter",
"limit",
"orderby"
)

Parameters:

ParameterRequiredDescriptionExample
graph_idYesUnique graph identifier"1"
axis_idYesWhich axis this series uses"1" or "2"
dataseries_labelYesLabel in legend"Employees"
seriesYesColumn for grouping"[key_company]"
measureYesValue to display"count(distinct [id])"
chart_typeYesType: "column", "spline", "line", "bar", etc."column"
aggregationNo"stacked" for columns, "" for lines"stacked" or ""
filterNoAdditional filter"[status] = 1"
limitNoLimit series items"10"
orderbyNoSort method"M"

Example - Column + Spline:

$olap.addGraphData("1", "1","Employees", "[key_company]", "count(distinct [employee_number])", "column","", "", "");
$olap.addGraphData("1", "2","Age", "[key_company]", "avg([age])", "spline","", "", "")
$olap.addGraphData("1", "2","Career", "[key_company]", "avg([career_length])", "spline","", "", "");

Example - Multiple columns on same axis:

$olap.addGraphData("1", "1","Revenue", "[month]", "sum([revenue])", "column","stacked", "", "");
$olap.addGraphData("1", "1","Cost", "[month]", "sum([cost])", "column","stacked", "", "");

Control responsive width using setGraphSize. Combined charts benefit from adequate space.

$olap.setGraphSize("graph_id", "XS12", "SM6", "MD6", "LG6")

Recommended sizes:

  • Medium: "XS12", "SM6", "MD6", "LG6" (half width)
  • Large: "XS12", "SM8", "MD8", "LG8" (two-thirds width)
  • Full: "XS12", "SM12", "MD12", "LG12" (full width)

Show counts as columns, percentages as line:

$olap.addGraph("1", "Sales Analysis", "[month]", "","0");
$olap.addGraphAxis('1', '1', 'Count','false')
$olap.addGraphAxis('1', '2', 'Percentage','true','0','100','10')
$olap.addGraphData("1", "1","Sales Count", "[month]", "count(*)", "column","", "", "");
$olap.addGraphData("1", "2","% of Total", "[month]", "count(*) / sum(count(*)) * 100", "spline","", "", "");

Compare related metrics:

$olap.addGraphAxis('1', '1', 'Revenue','false')
$olap.addGraphAxis('1', '2', 'Ratios','true','0','100','10')
$olap.addGraphData("1", "1","Revenue", "[month]", "sum([revenue])", "column","", "", "");
$olap.addGraphData("1", "2","Margin %", "[month]", "sum([profit])/sum([revenue])*100", "spline","", "", "");
$olap.addGraphData("1", "2","Growth %", "[month]", "((sum([revenue]) - lag(sum([revenue]))) / lag(sum([revenue]))) * 100", "spline","", "", "");

Show composition and trend:

$olap.addGraphData("1", "1","Product A", "[month]", "sum([sales_a])", "column","stacked", "", "");
$olap.addGraphData("1", "1","Product B", "[month]", "sum([sales_b])", "column","stacked", "", "");
$olap.addGraphData("1", "2","Total Trend", "[month]", "sum([sales_a]) + sum([sales_b])", "spline","", "", "");

Mix horizontal bars with lines:

$olap.addGraphData("1", "1","Volume", "[category]", "sum([volume])", "bar","", "", "");
$olap.addGraphData("1", "2","Efficiency", "[category]", "avg([efficiency])", "spline","", "", "");
  • Issue: Right axis scale changes when filtering, breaking comparisons
  • Fix: Always set explicit min, max, interval on second axis:
    $olap.addGraphAxis('1', '2', 'Label','true','0','100','10')
  • Check: Verify each series uses correct axis_id matching an axis
  • Check: Ensure chart_type is valid ("column", "spline", "line", etc.)
  • Check: Verify measures return numeric values
  • Issue: Multiple series obscure each other
  • Fix: Use different chart types (columns + lines instead of all columns)
  • Fix: Adjust series order (lines typically render on top)
  • Fix: Use transparency or different colors with setGraphColors
  • Issue: Series appears on wrong axis
  • Fix: Check axis_id in addGraphData matches axis_id in addGraphAxis
  • Fix: First axis should have opposite: false, second opposite: true
  • Issue: Hard to tell which series uses which axis
  • Fix: Use descriptive labels that indicate the measure type
  • Fix: Consider color coding (e.g., blue for left axis, red for right axis)

Q: Can I combine more than 2 chart types?
A: Yes, but it can become cluttered. Limit to 2-3 series for readability. Use different chart types (column + line) rather than all the same type.

Q: Do I need dual axes?
A: Only if measures have very different scales. If all measures are in similar ranges, use a single axis.

Q: Can I stack columns and show a line?
A: Yes, use aggregation: "stacked" for column series, and chart_type: "spline" or "line" for the trend.

Q: How do I ensure the second axis doesn’t auto-scale?
A: Always provide min, max, and interval parameters in the second addGraphAxis call with opposite: true.

Q: Can I have multiple lines on the same axis?
A: Yes, add multiple addGraphData calls with the same axis_id and chart_type: "spline" or "line".

Q: What chart types can I combine?
A: Common combinations: column + spline, column + line, bar + line. Most types can be combined, but test for readability.

Q: How do I color code by axis?
A: Use setGraphColors to assign colors. Typically, use one color family for left axis series, another for right axis.

Q: Can I combine pie with other types?
A: No, pie charts cannot be combined with other types in the same graph. Create separate graphs instead.