tessl install tessl/npm-lightdash--common@0.2231.5Shared TypeScript library for the Lightdash platform containing common types, utilities, and business logic for analytics workflows
Agent Success
Agent success rate when using this tile
72%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.09x
Baseline
Agent success rate without this tile
66%
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 passingdocs
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