{"id":16699669,"url":"https://github.com/apppear/chartviewv2demo","last_synced_at":"2025-03-21T19:32:41.880Z","repository":{"id":44874960,"uuid":"282496455","full_name":"AppPear/ChartViewV2Demo","owner":"AppPear","description":"Demo code for the upcoming SwiftUI ChartView v2 release","archived":false,"fork":false,"pushed_at":"2022-01-21T09:39:37.000Z","size":789,"stargazers_count":60,"open_issues_count":7,"forks_count":11,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-10-13T18:07:50.059Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AppPear.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-07-25T17:52:59.000Z","updated_at":"2024-09-24T18:07:56.000Z","dependencies_parsed_at":"2022-09-01T18:31:40.012Z","dependency_job_id":null,"html_url":"https://github.com/AppPear/ChartViewV2Demo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AppPear%2FChartViewV2Demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AppPear%2FChartViewV2Demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AppPear%2FChartViewV2Demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AppPear%2FChartViewV2Demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AppPear","download_url":"https://codeload.github.com/AppPear/ChartViewV2Demo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221818138,"owners_count":16885695,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-12T18:07:48.483Z","updated_at":"2024-10-28T10:43:16.859Z","avatar_url":"https://github.com/AppPear.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ChartViewV2Demo\nDemo code for the upcoming SwiftUI ChartView v2 release\n\nIn V2 a new structure is introduced. With this you will be able to create your charts with more modularity.\n\n![SwiftUI Charts](./Resources/showcase1.gif \"SwiftUI Charts\")\n\n## Creating a basic chart\n\nYou can create \n* barchart\n* linechart\n* piechart\n\nTo create a chart, initialise the chart type you would like to have then give it data and style: \n```swift\n@State var chartData: [Double] = [0, 5, 6, 2, 13, 4, 3, 6]\n\nBarChart()\n.data(chartData)\n.style(ChartStyle(...))\n```\n\n## Creating a cardview chart\n\nTo create a cardview chart, you just embed a basic chart in a CardView element, also cardview is a normal view now, so you can specify your frame if you like:\n\n```swift\nCardView {\n  ChartLabel(\"Title\", type: .title)\n  BarChart()\n}\n.data(chartData)\n.style(ChartStyle(...))\n```\n\nor \n\n```swift\nCardView {\n  BarChart()\n  ChartLabel(\"Text\", type: .custom(...))\n}\n.data(chartData)\n.style(ChartStyle(...))\n```\n\n## Adding a title, subtitle or custom text\n\nTitle, subtitle and text is now a standalone element, called `ChartLabel`. When you interact with the chart, the current chart value will automatically appear in place of the text in ChartLabel. You can add a ChartLabel by inserting above or below the chart:\n\n```swift\nCardView {\n  BarChart()\n}\n.data(chartData)\n.style(ChartStyle(...))\n.frame(width: 160, height: 240)\n```\n\n## ChartLabel\n\nHas types: \n* `title`\n* `largeTitle`\n* `subtitle`\n* `legend`\n* `custom(size: CGFloat, padding: EdgeInsets, color: Color)`\n\n## ChartStyle\n\nChartStyle contains as for now the backgournd and foreground color. Foreground color property is a array so you can have multiple colors in some charts.\nColors are a type of ColorGradient so it supports linear grandients and simple colors too.\n\ninitialisers: \n\n* `public init(backgroundColor: Color, foregroundColor: [ColorGradient])`\n* `public init(backgroundColor: Color, foregroundColor: ColorGradient)`\n* `public init(backgroundColor: ColorGradient, foregroundColor: ColorGradient)`\n* `public init(backgroundColor: ColorGradient, foregroundColor: [ColorGradient])`\n\n## CardView\n\n`public init(showShadow: Bool = true, @ViewBuilder content: @escaping () -\u003e Content)`\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapppear%2Fchartviewv2demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapppear%2Fchartviewv2demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapppear%2Fchartviewv2demo/lists"}