Deneb Workout 01 - Line Chart with Smoothing

Difficulty Rating: 1 out of 5

One of the features of a Line Chart created in Deneb in Power BI is that lines can be smoothed using various algorithms.

Goals

Using the simple supplied dataset, produce a Deneb visual in Power BI that:
• smooth the lines using the natural algorithm
• limit the number of entries on the Y-axis
• use the line colours defined in the current Power BI theme
• include a legend at top-left using lines as markers
• include a title and subtitle

Submission

Load the supplied data file into a new Power BI file, create your solution, and reply to this post. Upload a screenshot of your solution along with the Deneb/Vega-Lite JSON code used. Please format your JSON code and blur it or place it in a hidden section.

Period

This workout will be released on Monday March 20, 2023, and the author’s solution will be posted on Sunday March 26, 2023.

Greg

Deneb Workout 01 - Data - Sales by Channel.xlsx (9.7 KB)

Hi Greg,
Thanks for the workout. I have only dabbled with Deneb and haven’t used it for a while so it was a great refresher.

My colors are different but everything else seems ok. Here is my solution:

image

{
“title”: {
“text”: “Deneb Workout 01”,
“subtitle”:“Line Chart with Smoothing”,
“anchor”: “start”,
“align”: “left”,
“font”: “Verdana”,
“fontSize”: 14,
“fontWeight”: “bold”,
“subtitleFontStyle”: “italic”,
“subtitleFontSize”: 11,
“offset”: 10
},

“data”: {“name”: “dataset”},
“mark”: {
“type”: “line”,
“interpolate”: “natural”
},
“encoding”: {
“x”: {
“field”: “Order Date”,
“type”: “temporal”

},
"y": {
  "field": "Sales",
  "type": "quantitative",
  "scale": {"domain": [0, 60000]},
  "axis": {"tickCount": 5}
},
"color": {
  "field": "Channel Name",
  "scale": {
    "scheme": "pbiColorNominal"
  },
  "legend": {
        "orient": "top-left",
        "direction": "vertical",
        "title": null,
        "offset": 10,
        "labelColor": "black",
        "labelFont": "Segoe UI",
        "labelFontSize": 10,
        "symbolSize": 100,
        "symbolType": "stroke"
      }
}

}
}

Looks great @KimC … the colours should align to the theme used in your PBIX file; try some different themes.
Greg

@Greg Here is my submission.

image

Deneb Workout 001 - Line Smoothing Gerber.pbix (4.4 MB)

Hi,

Here is my Code: and immage of the visual

{
  "title": {
    "text": "Deneb Workout 01",
    "subtitle": "Line Chart with Smoothing",
    "anchor": "start",
    "align": "left"
  },
  "data": {"name": "dataset"},
  "mark": {
    "type": "line",

    "interpolate": "natural"
  },
  "encoding": {
    "x": {
      "field": "Order Date",
      "type": "temporal"
    },
    "y": {
      
      "field": "Sum of Total Sales",
      "type": "quantitative",
      "title": "Sales",
      "scale": {"domain": [0,60000]},
      "axis": {"tickCount": 5}
    },
    "color": {
      "title": null,
      "field": "Channel Name",
      "type": "nominal",
      "legend":{
        "orient": "top-left",
        "symbolType":"stroke"
      },
      "scale":{
        "scheme": "pbiColorNominal"
      }
    }
  }
}