Shared TypeScript library for the Lightdash platform containing common types, utilities, and business logic for analytics workflows
Overall
score
72%
Evaluation — 72%
↑ 1.09xAgent success when using this tile
Build a sales metrics comparison tool that displays period-over-period comparisons with configurable time granularity in chart tooltips.
You are building a Business Intelligence dashboard that shows sales metrics over time. When users hover over data points, they need to see not just the current value, but also how it compares to a previous period (e.g., previous month, same month last year). The comparison should adapt to different time granularities (daily, weekly, monthly, quarterly, yearly).
Implement a tooltip formatter for chart visualizations that:
Accept comparison configuration including:
Generate formatted tooltip content that displays:
Handle edge cases including:
Provides Business Intelligence utilities including chart data models, tooltip formatters, and query result handling.
Create a test file named comparison.test.ts with the following test cases:
Input:
Expected Output:
Input:
Expected Output:
Input:
Expected Output:
Input:
Expected Output:
src/comparison.ts - Main implementation file with period comparison logicsrc/comparison.test.ts - Test file with all test cases passingInstall with Tessl CLI
npx tessl i tessl/npm-lightdash--commondocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10
scenario-11
scenario-12
scenario-13
scenario-14
scenario-15
scenario-16
scenario-17
scenario-18
scenario-19
scenario-20