external/ag-shared/prompts/skills/example/ag-charts/features/reference-lines.md
Apply: 5 minutes, Impact: HIGH ⭐ RECOMMENDED for data with targets/thresholds
// Add context with reference lines (averages, targets, thresholds)
initialState: {
annotations: [
{
type: 'line',
yValue: 75000, // Target or threshold value
text: {
label: 'Q4 Target',
position: 'end',
alignment: 'left',
// Don't set fontSize or color - theme handles it
},
strokeWidth: 2,
lineDash: [6, 4],
// Don't set stroke color - theme provides it
},
],
}
initialState: {
annotations: [
{
type: 'line',
yValue: averageValue, // Calculated average
text: {
label: 'Average',
position: 'center',
},
strokeWidth: 1,
lineDash: [4, 4],
},
{
type: 'line',
yValue: targetValue, // Business target
text: {
label: 'Target',
position: 'end',
},
strokeWidth: 2,
lineDash: [8, 4],
},
{
type: 'line',
yValue: criticalThreshold, // Critical threshold
text: {
label: 'Critical',
position: 'start',
},
strokeWidth: 3,
// Solid line for critical values
},
],
}
// Calculate reference values from your data
const data = getData();
const values = data.map(d => d.value);
const average = values.reduce((a, b) => a + b, 0) / values.length;
const percentile90 = calculatePercentile(values, 90);
initialState: {
annotations: [
{
type: 'line',
yValue: average,
text: {
label: `Avg: ${average.toFixed(0)}`,
position: 'end',
},
strokeWidth: 1,
lineDash: [4, 4],
},
{
type: 'line',
yValue: percentile90,
text: {
label: '90th Percentile',
position: 'end',
},
strokeWidth: 2,
lineDash: [8, 4],
},
],
}
Apply: 6 minutes, Impact: HIGH for range-based analysis
// Highlight acceptable ranges or zones
initialState: {
annotations: [
{
type: 'area',
yValues: [60000, 80000], // Acceptable range
label: {
text: 'Target Range',
position: 'top-right',
// Don't set fontSize
},
// Don't set fill - theme provides appropriate opacity
},
],
}
Apply: 4 minutes, Impact: MEDIUM for storytelling
// Add contextual notes to specific data points
initialState: {
annotations: [
{
type: 'text',
xValue: 'Q2 2024',
yValue: 95000,
text: 'Product Launch',
// Don't set fontSize or color
},
{
type: 'text',
xValue: 'Q4 2024',
yValue: 120000,
text: 'Holiday Peak',
},
],
}
// Professional annotation setup combining multiple types
initialState: {
annotations: [
{
type: 'line',
yValue: yearlyTarget,
text: {
label: `${new Date().getFullYear()} Target`,
position: 'end',
},
strokeWidth: 2,
lineDash: [8, 4],
},
{
type: 'area',
yValues: [minAcceptable, maxAcceptable],
label: {
text: 'Acceptable Range',
position: 'top-left',
},
},
{
type: 'text',
xValue: significantDate,
yValue: significantValue,
text: 'Key Event',
},
],
}
initalState: {
annotations: [
{ type: 'line', yValue: breakEvenPoint, text: { label: 'Break Even' } },
{ type: 'line', yValue: profitTarget, text: { label: 'Profit Target' } },
],
}
initialState: {
annotations: [
{ type: 'line', yValue: upperControlLimit, text: { label: 'UCL' } },
{ type: 'line', yValue: lowerControlLimit, text: { label: 'LCL' } },
{ type: 'line', yValue: centerLine, text: { label: 'CL' } },
],
}
initialState: {
annotations: [
{ type: 'line', yValue: slaThreshold, text: { label: 'SLA: 99.9%' } },
{ type: 'area', yValues: [warningLower, warningUpper], label: { text: 'Warning Zone' } },
],
}
// Order of visual importance (strokeWidth and style)
initialState: {
annotations: [
// Most important - solid, thick
{ type: 'line', strokeWidth: 3, text: { label: 'Critical' } },
// Important - dashed, medium
{ type: 'line', strokeWidth: 2, lineDash: [8, 4], text: { label: 'Target' } },
// Context - dotted, thin
{ type: 'line', strokeWidth: 1, lineDash: [2, 2], text: { label: 'Average' } },
],
}
Before adding reference lines:
// Sales dashboard with target and average
initialState: {
annotations: [
{ yValue: monthlyTarget, text: { label: 'Monthly Target' }, strokeWidth: 2 },
{ yValue: rollingAverage, text: { label: '3-Month Avg' }, strokeWidth: 1, lineDash: [4, 4] },
],
}
// Market data with significant events
initialState: {
annotations: [
{ type: 'line', yValue: openingPrice, text: { label: 'Open' } },
{ type: 'text', xValue: eventDate, yValue: eventPrice, text: 'Earnings Release' },
],
}
// Control chart with limits
initialState: {
annotations: [
{ type: 'line', yValue: ucl, text: { label: 'UCL' }, strokeWidth: 1, lineDash: [4, 4] },
{ type: 'line', yValue: mean, text: { label: 'Mean' }, strokeWidth: 2 },
{ type: 'line', yValue: lcl, text: { label: 'LCL' }, strokeWidth: 1, lineDash: [4, 4] },
],
}