Skip to content

feat(core): add subtitles to every chart - #782

Merged
hdcodedev merged 1 commit into
mainfrom
feat/chart-subtitles
Oct 12, 2026
Merged

hdcodedev merged 1 commit into
mainfrom
feat/chart-subtitles

Conversation

@hdcodedev

Copy link
Copy Markdown
Member

Summary

  • Every chart takes an optional subtitle. It shows below the title with a 4 dp gap and stays visible when a selection changes the title. A subtitle also works without a title. A null or blank subtitle takes no space.
  • ChartContainerDefaults.style() takes styleTitle and styleSubtitle, and ChartContainerStyle has styleSubtitle. The subtitle defaults to 14 sp, normal weight, in the theme's onSurfaceVariant color (StyleDefaults.subtitle*).
  • A new internal ChartHeading draws the title and subtitle for every chart, so spacing and visibility live in one place.
  • Pie's selected title is now Category: share in one text, like the other one-series charts. It used to be the category followed by a smaller share in a separate text.
  • Charts in a parent with unbounded width, such as a horizontalScroll row, keep their title and subtitle visible. Line, live line, gauge, pie, and radar share a new FiniteWidthChartSizeModifier for this. The bar family already sized its root this way. Making the two families size the same way in a verticalScroll is tracked in [Issue] Size all charts the same way when the parent leaves height unbounded #780.
  • Docs: customization.md gains a Title and Subtitle section. pie-chart.md and the legend internals describe the new pie title.
  • Screenshots: new ChartSubtitleScreenshotTest (line, selected pie, subtitle-only gauge). PieChartSelectedSlicePreview and the README showcase references change with the pie title.

Local Validation

  • ./gradlew ktlintCheck
  • ./gradlew :charts-<module>:jvmTest
  • ./gradlew chartsTestJvm
  • ./gradlew ciCompile
  • ./gradlew chartsCheck
  • ./gradlew apiCompatibilityCheck
  • ../charts-playground/gradlew -p ../charts-playground -DchartsLocalPath="$PWD" ciCompile
  • ./gradlew :androidApp:validateDebugScreenshotTest
  • ./gradlew updateScreenshots

@hdcodedev
hdcodedev enabled auto-merge (squash) October 12, 2026 22:23
@hdcodedev
hdcodedev merged commit 1746e50 into main Oct 12, 2026
22 checks passed
@hdcodedev
hdcodedev deleted the feat/chart-subtitles branch October 12, 2026 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant