Deneb Power BI Using facet and layer Together

21 Views Asked by At

I have a code which is trying to give 2 line charts of budget-quantity of parts to produced and bar chart of parts produced for several projects (programs).

I tried to write the code but Deneb gives this error; Specification Error Your specification contains an error - the details we got from the compiler are as follows: Invalid specification {}. Make sure the specification includes at least one of the following properties: "mark", "layer", "facet", "hconcat", "vconcat", "concat", or "repeat". More information may be available in the Logs pane below.

Code is below, it didn`t work.

{
  "title": {
    "anchor": "start",
    "align": "left",
    "orient": "top",
    "offset": 5,
    "text": "MPS",
    "font": "Segoe UI",
    "fontSize": 20,
    "fontWeight": "bold",
    "fontStyle": "normal"
  },
  "data": {"name": "dataset"},
  "spacing": 5,
  "facet": {
    "column": {"field": "PROGRAMS"}
  },
  "spec": {
    "width": 125,
    "height": 530,
    "layer": [
      {
        "name": "line1",
        "mark": {
          "type": "line",
          "stroke": "#969696",
          "strokeWidth": 2
        },
        "encoding": {
          "y": {
            "field": "Planned",
            "type": "nominal"
          },
          "x": {"field":"AY",
          "type":"ordinal"}

        }
      },
      {
        "name": "Produced",
        "mark": {
          "type": "bar",
          "opacity": 0.7
        },
        "encoding": {
          "y": {
            "field": "M_Produced",
            "type": "nominal",
            "axis": {
              "domain": false,
              "ticks": false,
              "titleFontSize": 18,
              "labelFontSize": 14,
              "labelFontWeight": "normal",
              "labelBaseline": "middle"
            }
          },
          "x": {"field":"month",
          "type":"ordinal"}

          },
          
        }
      },
      {
        "name": "line2",
        "mark": {
          "type": "line",
          "stroke": "#969696",
          "strokeWidth": 2
        },
        "encoding": {
          "y": {
            "field": "Budget",
            "type": "quantitative"
          },
          "x": {"field":"month",
          "type":"ordinal"}

        }
      }
    ]
  }
}

I want to see 3 charts(2 line 1 bar) for each program (in a small multiply chart).

0

There are 0 best solutions below