Skip to main content
Known Participant
May 3, 2023
Question

Removing Legend Filter in Graph

  • May 3, 2023
  • 1 reply
  • 0 views

Is there any way to still keep the legend in a graph but remove the click on legend filter functionality? In this case I am referring to the Points legend; this is a sample graph I am playing around with in but I do not want the user to filter on legend in this case.

1 reply

May 4, 2023

This is not possible in chart Field configuration but you can add rich text component below chart and make it look like chartField's Legend.

a!localVariables(
  local!chartSeries: {
    a!map(label: "Point1", data: { 8.3, 3.02, 2.71 }),
    a!map(label: "Point2", data: { 8.3, 3.02, 2.71 }),
    a!map(label: "Point3", data: { 8.3, 3.02, 2.71 })
  },
  local!showLegend: false,
  {
    a!barChartField(
      categories: { "Baseball", "Hockey", "Soccer" },
      series: a!forEach(
        local!chartSeries,
        a!chartSeries(label: fv!item.label, data: fv!item.data)
      ),
      yAxisTitle: "Average Point per Professional Game",
      showLegend: local!showLegend,
      showDataLabels: true,
      colorScheme: "CLASSIC",
      showTooltips: false
    ),
    a!columnsLayout(
      columns: {
        a!columnLayout(
          contents: a!richTextDisplayField(
            labelPosition: "COLLAPSED",
            value: a!forEach(
              local!chartSeries.label,
              {
                a!richTextIcon(
                  icon: "circle",
                  color: "SECONDARY",
                  size: "SMALL"
                ),
                a!richTextItem(text: "  " & fv!item & "     ", size: "SMALL")
              }
            ),
            align: "CENTER"
          ),

        )
      },
      spacing: "NONE",
      showWhen: not(local!showLegend)
    )
  }
)