View Only

 CCC chart: Group stack bar chart combine with line.

  • Pentaho
  • Pentaho
Minh Chau's profile image
Minh Chau posted 02-12-2019 09:46

Hi everyone, I'am new to pentaho CDE.

I'm creating a CCC chart, I'm facing some issue with bar chart combine with line.


The plot 2 is sorted base on month and year. I want the plot 2 is sorted just by month in order to connect each of them together. Like this image below:


readers: ['measure, month, year, value'],

baseAxisComposite: true,

plots: [


name: 'main',

visualRoles: {

series: 'measure, year',

category: 'month, year'




type: 'point',

dataPart: '1',

linesVisible: true,

dotsVisible: true,

orthoAxis: 2,

colorAxis: 2,

nullInterpolationMode: 'linear'



any one can help me to check that, I have spent a lot of time on this issue. I really appreciate it.

Thanks in advance.

Duarte Cunha Leao's profile image
Duarte Cunha Leao

Hi Minh Chau,

I've setup an example similar to yours: Bar Chart - Stacked And Grouped with two plots - JSFiddle .


I did use a data set with a slightly different layout, which I believe is more adequate for this problem. In particular, I used two measure columns:

  1. year: 2017, 2018
  2. month: "Jan", "Feb", "Mar", "Apr",
  3. series: "a", "b"
  4. num: the number measure
  5. ratio: the ratio measure


If you can assume that the number of years in the comparison is always two, previous and current, then the chart can be built in a simpler way by using two overlapped stacked bar plots (instead of using a compositeAxis and a two levels category):

  1. Previous year (2017) — main bar plot uses dataPart=2017 and represents the num measure; bars displaced to the left
  2. Current year (2018) — second bar plot uses dataPart=2018 and represents the num measure; bars displaced to the right


This achieves the grouped and stacked arrangement of bars while preserving the base axis with the month field alone.


Two line plots can now also be defined to represent the ratio measure. Unfortunately, when the dataPart visual role is used, then all plots must specify a single value, and so two line plots are a necessity as well to cover both years.



Duarte Cunha Leão

Minh Chau's profile image
Minh Chau

Hi Duarte Leao

Thanks a lot, I read your code very carefully.  it works like a charm.

Currently I am using cross tab Mode, I had to turn it to false as your code mention, edited my sql query, then it works.