apppear / chartview Goto Github PK
View Code? Open in Web Editor NEWChartView made in SwiftUI
License: MIT License
ChartView made in SwiftUI
License: MIT License
Hi There thanks for this great library!
I was playing with it but couldn't figure out how to change the color of the individual slices in the pie chart, or add text/images.. Is that possible?
Thanks!
Yair
Hi buddy,
Issue:- I was unable to import this library to WatchOS Extension.
I have tried this awesome library. just want you to add support for watchOS too.
Thanks,
Saurabh Prajapati
Given the array, [0.6137386018237082, 0.2815539332538736, 0.17518342474101156, 0.24931948665991222, -1.1515280464216635, 1.1460104011887073, 0.2818422889043964, -1.3491616766467065, 1.5056442831215968, 0.6401420838971583, -56.699696969696966]
, of values, I get the following graph
Some content is clipped off. I looked at the source code and it has something to do with step height.
Hi,
How can I use on Apple Watch?
Many thanks,
Bogdan
Hey love your work with the charts
im use you charts to show a large amount of data and on some of the charts the line pops out of the view must be the Legend view that cut the view of the line..
my question is how do i fix this..?
it looks great on most view but a few the line pops out of the view..
The text color of the labels is not correct in Dark Mode. Looks like it is white text on a white background. I have attached a picture to show what I mean.
Hey,
I am currently doing:
LineView(data: self.insightData.chart.balances, dates: self.insightData.chart.dates)
self.insightData is a @published variable.
When the value of variable changes the chart crashes. Here is the error I keep getting.
Hello
I am just curious is there is any exceptions that the library will expand to other charts/graphs like the Spider (aka Radar) chart/graph?
I love this library and have uses it to jump start charting in a few of my apps. I recently was pulling my hair out trying to build a Form in an app that implements this library. I had a flaky and vague build issue (Argument passed to call that takes no arguments) whenever I tried to wrap views in a Form (SwiftUI form). I tracked the issue to a redeclaration of the struct Form in the Helpers.swift file in this library. Please rename this struct so it doesn't break SwiftUI Forms.
Hey,
ChartView is working fine on MacOS, but when using ChartView() without the explicit form: CGSize()
attribute, then the appearing view is not the actual frame, which results in major glitches when using VStack or HStack (overlapping with other views). Will look into it and might push a PR 📦
How can I do this?
Hey :)
I just discovered this amazing library. It seems to do most of what I want. However, two things that bug me are the inability to have labels / units on the X-Axis for LineChart and the lack of simple way of specifying range for the Y axis. Are those features planned / would they be accepted in a PR if I get to implementing them (won't be immediately unfortunately).
Thanks :)
Test data:
LineView(data: [-2,1,0,2,-1,-2,1,0,-2,1,0,2,-1,-2,1,0,-2,1,0,2,-1,-2,1,0,-2], title: "title", legend: "legend")
Expected result: LineChart is correctly shown.
Actual result: All bars are shown in the upper part of chart.
Hello,
what would be the smartest way to build a graph that compares two values and show each bar in a different color?
Thanks and kind regards
When using ObservedObject data, errors like below:
`
@ObservedObject var dashboardDataModel: DashboardDataModel
......
BarChartView(data: ChartData(points: self.dashboardDataModel.response.data.pastThirtyDayChecksArray ),
title: "Checks",
form: ChartForm.medium, dropShadow: false
)
......
onAppear {
self.dashboardDataModel.fetchData()
}
the error:
ForEach<Range, Int, ModifiedContent<ModifiedContent<BarChartCell, _ScaleEffect>, _TransactionModifier>> count (30) != its initial count (0). ForEach(_:content:)
should only be used for constant data. Instead conform data to Identifiable
or use ForEach(_:id:content:)
and provide an explicit id
!
`
Hello
I installed the package, and it worked, but when i wrote :
import SwiftUICharts
I got this error :
No such module 'SwiftUICharts'
Please consider enabling double or float values for the line. Or maybe I just didn't find the option to enable?
Hello,
First of all, wanted to say, this is an awesome project.
As of now, well explained from the README, we need to install this project by doing:
In xCode got to File -> Swift Packages -> Add Package Dependency and paste inthe repo's url: https://github.com/AppPear/ChartView
Would it make more sense to have some sort of management with CocoaPods, or Carthage and such instead?
Thank you
Can I use it in Storyboard project?
Crashes when empty array is passed as values of BarChartView
How can I get screenshot of Chart?
I have a data set consisting of 2,000-3,300 plots on the x axis, is there a way to make these more visible? I can't see any of my lines. The only problem is the y plots are only between 0-15
What is this library licensed under? It'd be great to specify one with a LICENSE file.
The chart disappears and the animation reverses when returning from a navigation view details page. Going to detail page again and returning will reanimate the chart and all is well again. This is a repeated pattern back and forth causes the same behavior over and over.
BarChartView(data: ChartData(points: [0,0,0,0]), title: "Start from Zero", legend: "Growing up")
Not Empty, but zero
Crash
Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [nan nan]. Layer: <SwiftUI.GradientLayer:0x600001445f10; position = CGPoint (0 0); bounds = CGRect (0 0; 0 0); delegate = <_TtC7SwiftUIP33_A34643117F00277B93DEBAB70EC0697122_UIShapeHitTestingView: 0x7fd8a9629e80; frame = (-8.98847e+307 -8.98847e+307; 1.79769e+308 1.79769e+308); transform = [nan, nan, nan, nan, 0, 0]; anchorPoint = (0, 0); autoresizesSubviews = NO; layer = <SwiftUI.GradientLayer: 0x600001445f10>>; allowsGroupOpacity = YES; transform = CATransform3D (nan nan 0 0; nan nan 0 0; 0 0 1 0; 0 0 0 1); cornerRadius = 4; anchorPoint = CGPoint (0 0)>'
When I use the Libary in Beta 5, I get an Error inside the path Computed Properties in the PieChartCell Struct. It will crash the Application
As of now, the LineView always has a black background if the device is in dark mode. This is a problem if the chart is to be put on a different colored background (or simply a modal presented sheet).
Would you consider an option to add a dark mode background color as well?
How to reproduce:
LineView(data: [5,8,23,54,0,12,37,7,23,43], title: "Line chart")
On line 43 of BarChartView.swift, I get the following error...
Value of optional type 'Bool?' must be unwrapped to a value of type 'Bool'
Thanks a lot for your work!, I found that BarChart can't work with NavigationLink, My code are as follows:
NavigationView{
...
VStack(alignment: .leading) {
NavigationLink(destination: ReviewToday()){
BarChartView(
data: ChartData(points: [110,23,54,32,12,37,7,23,43]),
title: "最近7日",
form: ChartForm.large
).padding()
}
}
}
when I click this chart, I can't get my destination view (ReviewToday())
AND, pieChart can show the correct View when I click.
the pieChart codes are as follows:
NavigationLink(destination: ReviewToday()){
PieChartView(
data: [Double(todayCompletedTasks.count),Double(todayRemainTasks.count)],
title: "今日 \(todayRemainTasks.count)/\(todayCompletedTasks.count)",
form: ChartForm.medium
).padding()
}
UPDATE: I found by accident that when I long press BarChart, it works ! 23333, I guess that the NavigationLink tap gesture Conflict with BarChart's gesture.
is there any way to avoid this bug-seem thing happen?
Hi, I'm getting this error message "Property 'body' must be declared public because it matches a requirement in public protocol 'View' " seems like an easy enough change to make.
I‘ve forked the swiftuicharts,and cloned by xcode.
but the charts can't be previewed.
for example,I select the multiLineChartView ,and click the preview
nothing display in the canvas
Hello,
Wanted to say, this pie chart is simply beautiful.
If I may, the definition of a pie chart is: (taken randomly from any dictionary on the web)
pie chart
noun
a graphic representation of quantitative information by means of a circle divided into sectors, segment, in which the relative sizes of the areas (or central angles) of the sectors correspond to the relative sizes or proportions of the quantities.
Would it be possible to have a way to define the sectors, segments?
For instance, in your example:
PieChartView(data: [8,23,54,32], title: "Title", legend: "Legendary") // legend is optional
Would it be possible to do something like:
PieChartView(data: [8,23,54,32], segmentDescription: ["student", "active professional", "retired", "without job"], title: "category in % leaving in city X", legend: "Legendary") // legend is optional
So we can understand 8% are students, 23% are active professional, etc...
PieChartView(data: [8,23,54,32], segmentDescription: ["soccer player", "tennis player", "judo player", "gymnast"], title: "athlete going to the Olympic", legend: "Legendary") // legend is optional
So we can understand 8% are soccer players, 23% are tennis players, etc...
The main idea is to be able to provide description for one piece of the pie chart, not just an overall title/legend. For instance, in your picture, there is no way to say what corresponds to the smallest or biggest part of the pie without a lengthy Title/Legend.
I believe this would further increase the usage and the good experience using pie chart.
Thank you for your help
Is it possible to make a linechart view with three lines in there? And without the 'fill' ?
So something like:
LineChartView(data1: [8,23,54,32,12,37,7,23,43], title: "Title1", legend: "Legendary"; data2: [9,22,52,30,10,30,9,27,47], title: "Title 2", legend: "Epic" )
If you try inputting a single value into the the line view, nothing displays. I looked at the source code and it makes sense since you need 2 points to draw a line. Also, inputting any negative values will cause nothing to display. Support should be added for negative numbers as well.
It appears the LineChartView always displays 14. The struct has an optional value but the initializer force unwraps the parameter causing it to crash if giving the value nil.
Hi,
I want to integrate SwiftUICharts in to existing Swift project (This project developed using UIKit, UIViewController) based application.
Please let me know the possible solution.
hey nice work i'm having issues making the chart show numbers over 100
it only show data values to 99.9 how to make it go over 100.0..??
thanks
Installed SwiftUICharts in the package manager in Xcode 11 beta 4. It is visible in the project navigator (Swift Package Dependencies).
I made a new SwiftUI file, called ChartView.
`import SwiftUI
import SwiftUICharts
struct ChartView: View {
var body: some View {
ChartView(data: [12,17,24,33,23,56], title: "Chart two", form: Form.small) }
}
#if DEBUG
struct ChartView_Previews: PreviewProvider {
static var previews: some View {
ChartView()
}
}
#endif
`
Now I'm getting an error "Argument passed to call that takes no arguments".
seems that is built in and there's no way to replace it? Would love to be able to add my own image there.
First of all - thanks for creating this library, it's awesome!💥
I'd like to out have a few LineViews inside a Vstack or ScrollView. Unfortunately, I'm not sure what is the best way to accomplish that without some layout issues. (please take note I'm fairly new to SwiftUI :))
When I put them in Vstack, they got squeezed like so:
var body: some View {�
VStack(alignment: .leading, spacing: 20) {
LineView(data: [8,23,54,32,12,37,7,23,43], title: "Line chart", legend: "Full screen")
LineView(data: [8,23,54,32,12,37,7,23,43], title: "Line chart", legend: "Full screen")
LineView(data: [8,23,54,32,12,37,7,23,43], title: "Line chart", legend: "Full screen")
When I wrap the above in a ScrollView, I get the following layout and touch event is no longer being detected on the chart:
var body: some View {
ScrollView(.vertical, showsIndicators: false) {
VStack(alignment: .leading, spacing: 20) {
LineView(data: [8,23,54,32,12,37,7,23,43], title: "Line chart", legend: "Full screen")
LineView(data: [8,23,54,32,12,37,7,23,43], title: "Line chart", legend: "Full screen")
I haven't found any related issue here (maybe I overlooked something), so maybe that's not a bug but just me doing something wrong :)
Let me know if you have an idea what the best approach is ;)
Hey, first: The charts look awesome!
But I wonder if it is possible to remove the drop shadow and make the chart fullscreen? At least being able to make a custom size for the line chart would be very nice.
While I like the idea of those small cards, the charts look and behave too good not to use them as full blown charts inside an app.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.