migration to altair plots

This commit is contained in:
2026-01-28 21:01:39 +01:00
parent 3f929d93fd
commit 0485f991d2
5 changed files with 601 additions and 828 deletions

View File

@@ -23,3 +23,58 @@ class ColorPalette:
TEXT = "black"
GRID = "lightgray"
BACKGROUND = "white"
def jpmc_altair_theme():
"""JPMC brand theme for Altair charts."""
return {
'config': {
'view': {
'continuousWidth': 1000,
'continuousHeight': 500,
'strokeWidth': 0
},
'background': ColorPalette.BACKGROUND,
'axis': {
'grid': True,
'gridColor': ColorPalette.GRID,
'labelFontSize': 11,
'titleFontSize': 12,
'labelColor': ColorPalette.TEXT,
'titleColor': ColorPalette.TEXT,
'labelLimit': 200 # Allow longer labels before truncation
},
'axisX': {
'labelAngle': -45,
'labelLimit': 200 # Allow longer x-axis labels
},
'axisY': {
'labelAngle': 0
},
'legend': {
'orient': 'top',
'direction': 'horizontal',
'titleFontSize': 11,
'labelFontSize': 11
},
'title': {
'fontSize': 14,
'color': ColorPalette.TEXT,
'anchor': 'start',
'subtitleFontSize': 10,
'subtitleColor': 'gray'
},
'bar': {
'color': ColorPalette.PRIMARY
}
}
}
# Register Altair theme
try:
import altair as alt
alt.themes.register('jpmc', jpmc_altair_theme)
alt.themes.enable('jpmc')
except ImportError:
pass # Altair not installed