Line highlight

Hover a legend entry or line; the rest fade.

Chart type
Line line
Tier
Free Core
Collection
Highlight filter
Render
Live, site theme
View .md Agent setup
LIVE/highlight-filter/line-highlight4 of 23 in Highlight & filter

Configuration

Raw Standalone
const options = {
  chart: {
    height: 380,
    fontFamily: "Inter, Geist, \"IBM Plex Sans\", system-ui, sans-serif",
    type: "line",
    toolbar: {
      show: false
    }
  },
  series: [
    {
      name: "Lisbon",
      data: [54, 57, 54, 53, 51, 49, 50, 48, 52, 55, 57, 57, 54, 52, 52, 48, 51, 50, 54, 54]
    },
    {
      name: "Oslo",
      data: [48, 49, 52, 51, 55, 51, 50, 51, 55, 57, 61, 61, 62, 60, 64, 64, 61, 62, 60, 59]
    },
    {
      name: "Seattle",
      data: [53, 53, 55, 56, 54, 54, 51, 53, 49, 52, 49, 47, 50, 50, 51, 54, 57, 54, 54, 53]
    },
    {
      name: "Osaka",
      data: [51, 50, 53, 57, 54, 58, 60, 62, 64, 64, 61, 62, 61, 59, 56, 54, 54, 56, 59, 59]
    },
    {
      name: "Austin",
      data: [52, 49, 51, 50, 47, 46, 48, 52, 51, 52, 53, 56, 53, 57, 57, 61, 63, 67, 66, 68]
    },
    {
      name: "Porto",
      data: [47, 45, 45, 48, 46, 43, 45, 49, 50, 51, 49, 46, 44, 47, 44, 40, 38, 35, 38, 41]
    }
  ],
  legend: {
    onItemHover: {
      highlightDataSeries: true
    }
  },
  stroke: {
    width: 2.5
  },
  title: {
    text: "Bookings by city"
  },
  theme: {
    mode: "light",
    preset: "coastal"
  }
}

const chart = new WestCoastCharts(document.querySelector('#chart'), options)
chart.render()