google / charts

https://pub.dev/packages/charts_flutter
Apache License 2.0
2.81k stars 1.21k forks source link

Gauge graph, partial pie and partial donut graphs #121

Open JamesMcIntosh opened 6 years ago

JamesMcIntosh commented 6 years ago

By adding a parameter for arc length to the arc renderer. Using the existing configuration at least three additional graph can be accomplished, see images below.

Example config for Gauge Graph:

new charts.PieChart(seriesList,
    animate: animate,
    defaultRenderer: new charts.ArcRendererConfig(
    arcWidth: 60,
    startAngle: 4 / 5 * pi,
    arcLength: 7 / 5 * pi,
  ),
);

Gauge graph arc-graph-gauge Partial pie arc-graph-partial-pie Partial donut arc-graph-partial-donut

VyMajoris commented 5 years ago

I take that this has not been released yet?

This page details how to create a gauge graph, but the arcLength is not present on current version, 0.4.0

lorrainekan commented 5 years ago

Yes, it has not yet been released.

JamesMcIntosh commented 5 years ago

@VyMajoris You can use git repos as a dependency and specify "dependency_overrides" element in your pubspec to get early access to it.

https://www.dartlang.org/tools/pub/dependencies#git-packages https://www.dartlang.org/tools/pub/dependencies#dependency-overrides

Add something like this to your pubspec.yaml (untested).

dev_dependencies:
  charts_flutter: 0.4.0

dependency_overrides:
  charts_common:
    git:
      url: git@github.com:google/charts.git
      path: charts_common
  charts_flutter:
    git:
      url: git@github.com:google/charts.git
      path: charts_flutter
VyMajoris commented 5 years ago

@JamesMcIntosh

Thanks! I didn't know that.

supermarcos commented 5 years ago

@JamesMcIntosh That didn't work for me... I literally copied and pasted exactly that code under my dev_dependencies section (although I didn't put charts_flutter: 0.4.0 under dev_dependencies: because I already have it under dependencies: (and it makes more sense there).

Any idea what could be happening?

The error I'm getting is

Could not find a file named "charts_flutter/pubspec.yaml" in https://github.com/google/charts/tree/master/charts_flutter..."
pub get failed (1)
exit code 1

Also, @lorrainekan any idea about when is it going to be released?

Thank you!

JamesMcIntosh commented 5 years ago

@supermarcos the error message is pretty specific, it can't find the yaml file. Did you add both dependencies? Try and turn on verbose logging when running the flutter command.

flutter packages get -v

Look for the pub command and run it manually setting --verbosity=warning to --verbosity=all, i.e.

<PATH_TO_FLUTTER>/flutter/bin/cache/dart-sdk/bin/pub --verbosity=solver --verbose get --no-precompile
supermarcos commented 5 years ago

Hello, @jamesmcintosh Thanks for replying. Yeah, the message seems pretty specific... and confusing. The yaml for the proyect is there and the yaml for each of the libraries are inside the url written so I assume something else may be happening, but the error in that case wouldn't be correct or, at least, is confused. Any other idea? I will try those commands when I have time and let you know. Thank you!

supermarcos commented 5 years ago

H @JamesMcIntosh I tried the commands you told me and I got this:

PS D:\Marcos\projects\flutter\smartbreathtrainingapp> C:\flutter\bin\cache\dart-sdk\bin\pub.bat --verbosity=all --verbose get --no-precompile
FINE: Pub 2.1.0-dev.5.0.flutter-a2eb050044
IO  : Spawning "cmd /c ver" in D:\Marcos\projects\flutter\smartbreathtrainingapp\.
IO  : Finished ver. Exit code 0.
    | stdout:
    | |
    | | Microsoft Windows [Version 10.0.17134.345]
    | Nothing output on stderr.
MSG : Resolving dependencies...
SLVR: fact: SBT is 1.0.0+1
SLVR: derived: SBT
SLVR: fact: SBT depends on scoped_model ^0.3.0
SLVR: fact: SBT depends on flutter any from sdk
SLVR: fact: SBT depends on cupertino_icons ^0.1.2
SLVR: fact: SBT depends on flutter_sparkline ^0.1.0
SLVR: fact: SBT depends on http ^0.11.3+17
SLVR: fact: SBT depends on flutter_circular_chart ^0.1.0
SLVR: fact: SBT depends on flutter_test any from sdk
SLVR: fact: SBT depends on charts_common from git
SLVR: fact: SBT depends on charts_flutter from git
SLVR:   selecting SBT
SLVR:   derived: charts_flutter from git
SLVR:   derived: charts_common from git
SLVR:   derived: flutter_test any from sdk
SLVR:   derived: flutter_circular_chart ^0.1.0
SLVR:   derived: http ^0.11.3+17
SLVR:   derived: flutter_sparkline ^0.1.0
SLVR:   derived: cupertino_icons ^0.1.2
SLVR:   derived: flutter any from sdk
SLVR:   derived: scoped_model ^0.3.0
IO  : Spawning "cmd /c git --version" in D:\Marcos\projects\flutter\smartbreathtrainingapp\.
IO  : Finished git. Exit code 0.
    | stdout:
    | | git version 2.19.1.windows.1
    | Nothing output on stderr.
FINE: Determined git command null.
IO  : Spawning "cmd /c git clone --mirror git@github.com:google/charts.git C:\Users\Marcos\AppData\Roaming\Pub\Cache\git\cache\charts-7c858db0485b086b1459b94da2e52df2cc096d6f" in D:\Marcos\projects\flutter\smartbreathtrainingapp\.
IO  : Finished git. Exit code 128.
    | Nothing output on stdout.
    | stderr:
    | | Cloning into bare repository 'C:\Users\Marcos\AppData\Roaming\Pub\Cache\git\cache\charts-7c858db0485b086b1459b94da2e52df2cc096d6f'...
    | | Host key verification failed.
    | | fatal: Could not read from remote repository.
    | |
    | | Please make sure you have the correct access rights
    | | and the repository exists.
SLVR: Version solving took 0:00:01.619222 seconds.
    | Tried 1 solutions.
FINE: Resolving dependencies finished (1.638s).
ERR : Git error. Command: git clone --mirror git@github.com:google/charts.git C:\Users\Marcos\AppData\Roaming\Pub\Cache\git\cache\charts-7c858db0485b086b1459b94da2e52df2cc096d6f
    | Cloning into bare repository 'C:\Users\Marcos\AppData\Roaming\Pub\Cache\git\cache\charts-7c858db0485b086b1459b94da2e52df2cc096d6f'...
    | Host key verification failed.
    | fatal: Could not read from remote repository.
    |
    | Please make sure you have the correct access rights
    | and the repository exists.
FINE: Exception type: GitException
FINE: package:pub/src/git.dart 55:26              run
    | ===== asynchronous gap ===========================
    | dart:async                                  _AsyncAwaitCompleter.completeError
    | package:pub/src/git.dart                    run
    | ===== asynchronous gap ===========================
    | dart:async                                  _asyncThenWrapperHelper
    | package:pub/src/git.dart                    run
    | package:pub/src/source/git.dart 490:14      BoundGitSource._clone.<fn>
    | dart:async                                  new Future.sync
    | package:pub/src/source/git.dart 481:19      BoundGitSource._clone
    | package:pub/src/source/git.dart 414:11      BoundGitSource._createRepoCache
    | ===== asynchronous gap ===========================
    | dart:async                                  _asyncThenWrapperHelper
    | package:pub/src/solver/version_solver.dart  VersionSolver.solve
    | package:pub/src/solver.dart 35:10           resolveVersions.<fn>
    | package:pub/src/log.dart 378:18             progress
    | package:pub/src/solver.dart 32:10           resolveVersions
    | package:pub/src/entrypoint.dart 200:24      Entrypoint.acquireDependencies

Correct me if I'm wrong but that looks like permissions... could that be? How can I clean that cache folder?

JamesMcIntosh commented 5 years ago

@supermarcos You probably don't have SSH access set up for git, use a HTTP format git URL instead.