Coder Social home page Coder Social logo

chartview's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

chartview's Issues

Custom dropshadow and size

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.

Can't preview the charts

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

only go to 99.9

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

BarChartView Bool error

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'

AppPear/ChartView - PieChartView support for segment/sector/pie description

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

Dark Mode Labels incorrect

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.

Image

Thousands of Data Points

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

X-axis labels for LineChart

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 :)

Apple Watch

Hi,

How can I use on Apple Watch?

Many thanks,

Bogdan

Error in Beta 5, PieChartCell

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

AppPear/ChartView on CocoaPods

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

Alternating bar colors

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

First try

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".

Support for WatchOS

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

line pop out of view..?

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..

LineChartView always displays a constant 14

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.

LineView in dark mode

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?

LineView not properly scaling with large values

When data array contains values below, the LineView looks how it does below.

[282.502, 284.495, 283.51, 285.019, 285.197, 286.118, 288.737, 288.455, 289.391, 287.691, 285.878, 286.46, 286.252, 284.652, 284.129, 284.188]

Screen Shot 2020-03-06 at 11 19 53 AM

Form Redeclaration

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.

ForEach(_:content:)` should only be used for *constant* data.

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!
`

Multiple lines

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" )

public modifier needed for body

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.

Double or Float values

Please consider enabling double or float values for the line. Or maybe I just didn't find the option to enable?

Multiple LineViews in Vstack/ScrollView

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 ;)

Single value or negative values cause no display

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.

BarChart can not work with NavigationLink

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?

Support for negative numbers in chart.

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.

Crash BarChartView(data: ChartData(points: [0,0,0,0])...

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)>'

Error when I import the package

Hello
I installed the package, and it worked, but when i wrote :

import SwiftUICharts

I got this error :
No such module 'SwiftUICharts'

MacOS frame improvement

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 📦

Updating the chart data

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.

Screen Shot 2019-11-25 at 10 47 48 PM

Line isn't graphed properly for specific values

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

Screen Shot 2019-12-30 at 2 55 29 PM

Some content is clipped off. I looked at the source code and it has something to do with step height.

License

What is this library licensed under? It'd be great to specify one with a LICENSE file.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.