Skip to content

[Insights][R4][App] Support count metrics in charts and data tables #102808

Open

Description

@aldo-expensify

Implement this section of the design doc: Support the count metric in charts.

Description

Allow Compliance charts and their data tables to display counts while preserving the existing amount behavior for Search, Home, and Spend.

  • Introduce SearchChartMetric = amount | count, add metric to InsightsChartSpec, and pass it from InsightsChartWidget to SearchChartView, defaulting to amount.
  • Update buildFlatSeries to read the grouped row's count for count metrics. Amount metrics continue reading total and converting from the currency's minor units.
  • Apply the selected metric to current and comparison series, including Average baselines and deltas.
  • Resolve the metric's value formatter in SearchChartView and pass it through SearchChartProps to BarChart, LineChart, and PieChart.
  • Update useChartLabelFormats so axes, plotted-value labels, pie totals, and tooltips use the selected formatter. Counts use numberFormat without a currency unit.
  • Pass the metric and formatter through renderDetails so InsightsDataTable displays the same values as the chart.

Acceptance criteria

  • Counts display without currency units or currency minor-unit conversion.
  • Current values, comparisons, Average baselines, and deltas use the selected metric consistently.
  • Chart labels, tooltips, totals, and data tables agree.
  • Existing Search, Home, and Spend charts retain their amount behavior.
  • Include relevant series-construction tests and manual chart/table regression steps.
Issue OwnerCurrent Issue Owner: @mhawryluk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions