pentahopentaho-cde

How input data in line chart in Pentaho?


I want to make this chart in Pentaho CDE: enter image description here
based in this chart (I think that is the most similar from among CCC Components):
enter image description here (The code is in this link.)

but I don't know how I can adapt my data input to that graph. For example, I want to consume the data with this format:

[Year, customers_A, customers_B, cars_A, cars_B]
[2014, 8, 4, 23, 20]

[2015, 20, 6, 30, 38]

How I can input my data in this chart?


Solution

  • Your data should come as an object such as this:

    data = {
      metadata: [
        { colName: "Year", colType:"Numeric", colIndex: 1},
        { colName: "customers_A", colType:"Numeric", colIndex: 2},
        { colName: "customers_B", colType:"Numeric", colIndex: 3},
        { colName: "cars_A", colType:"Numeric", colIndex: 4},
        { colName: "cars_B", colType:"Numeric", colIndex: 5}
      ],
      resultset: [
        [2014, 8, 4, 23, 20],
        [2015, 20, 6, 30, 38]
      ],
      queryInfo: {totalRows: 2}
    }