updated readme - v 1

This commit is contained in:
TAJAOUART Mounir 2023-02-11 10:59:24 +01:00
parent f7886e5a09
commit d8401b6038
6 changed files with 82 additions and 66 deletions

View File

@ -1,3 +1,9 @@
## 0.0.1 ## 0.0.1 (Initial Release)
- Initial release of the real_time_chart package.
- Added the RealTimeChart widget, which displays a real-time graph of data.
- Supports positive and negative values.
- Adapts height depending on max value.
- Includes example usage with a stream of data.
* TODO: Describe initial release.

View File

@ -1,39 +1,60 @@
<!-- # Real-time Chart
This README describes the package. If you publish this package to pub.dev,
this README's contents appear on the landing page for your package.
For information about how to write a good package README, see the guide for A Flutter package for displaying real-time charts with flexible customization options.
[writing package pages](https://dart.dev/guides/libraries/writing-package-pages).
<img src="https://raw.githubusercontent.com/tajaouart/real_time_chart/main/real_time_chart_demo.gif" height="600"/>
For general information about developing packages, see the Dart guide for
[creating packages](https://dart.dev/guides/libraries/create-library-packages)
and the Flutter guide for
[developing packages and plugins](https://flutter.dev/developing-packages).
-->
TODO: Put a short description of the package here that helps potential users
know whether this package might be useful for them.
## Features ## Features
- Display real-time data on a graph
TODO: List what your package can do. Maybe include images, gifs, or videos. - Supports negative values
- Adapts height automatically based on the maximum value
- Customizable colors, axis labels, and grid lines
## Getting started ## Getting started
TODO: List prerequisites and provide or point to information on how to To use this package, add `real_time_chart` as a dependency in your pubspec.yaml file.
start using the package.
```yaml
dependencies:
real_time_chart: ^0.0.1
```
## Usage ## Usage
TODO: Include short and useful examples for package users. Add longer examples To display a real-time chart, you can use the `RealTimeChart` widget. Here's an example of how to use it in your code:
to `/example` folder.
```dart ```dart
const like = 'sample'; import 'package:real_time_chart/real_time_chart.dart';
class RealTimeChartExample extends StatelessWidget {
@override
Widget build(BuildContext context) {
return RealTimeChart(
stream: positiveDataStream(),
graphColor = Colors.red,
);
}
}
Stream<double> positiveDataStream() {
return Stream.periodic(const Duration(milliseconds: 500), (_) {
return Random().nextInt(300).toDouble();
}).asBroadcastStream();
}
``` ```
## Additional information ## Additional information
TODO: Tell users more about the package: where to find more information, how to This package provides a simple solution for displaying real-time data in a graph format. It offers support for both positive and negative values and automatically adapts the height of the graph to fit the maximum value.
contribute to the package, how to file issues, what response they can expect
from the package authors, and more. If you encounter any issues or bugs while using the package, feel free to file an issue in the [issue tracker](https://github.com/tajaouart/real_time_chart/issues). We are committed to providing quick and helpful responses to any questions or concerns that you may have.
If you would like to contribute to the development of this package, we welcome pull requests and any other forms of contribution. Your help and support are greatly appreciated!

View File

@ -1,3 +1,9 @@
// Copyright (c) 2023 Tajaouart Mounir
//
// This demo showcases the usage of the `RealTimeGraph` widget
// and provides an example of how to use it in a Flutter app.
// Website: https://tajaouart.com
import 'dart:math'; import 'dart:math';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -8,22 +14,23 @@ void main() {
} }
class MyApp extends StatelessWidget { class MyApp extends StatelessWidget {
const MyApp({super.key}); const MyApp({Key? key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return MaterialApp( return MaterialApp(
title: 'Flutter Demo', debugShowCheckedModeBanner: false,
title: 'Real-Time Chart Demo',
theme: ThemeData( theme: ThemeData(
primarySwatch: Colors.blue, primarySwatch: Colors.blue,
), ),
home: const MyHomePage(title: 'Flutter Demo Home Page'), home: const MyHomePage(title: 'Real-Time Chart Demo'),
); );
} }
} }
class MyHomePage extends StatefulWidget { class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title}); const MyHomePage({Key? key, required this.title}) : super(key: key);
final String title; final String title;
@ -44,7 +51,9 @@ class _MyHomePageState extends State<MyHomePage> {
width: double.maxFinite, width: double.maxFinite,
child: SingleChildScrollView( child: SingleChildScrollView(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
// Display a real-time graph of positive data
SizedBox( SizedBox(
width: MediaQuery.of(context).size.width, width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.width * 0.8, height: MediaQuery.of(context).size.width * 0.8,
@ -55,6 +64,8 @@ class _MyHomePageState extends State<MyHomePage> {
), ),
), ),
), ),
// Display a real-time graph of positive data as points
const SizedBox(height: 32), const SizedBox(height: 32),
SizedBox( SizedBox(
width: MediaQuery.of(context).size.width, width: MediaQuery.of(context).size.width,
@ -67,7 +78,15 @@ class _MyHomePageState extends State<MyHomePage> {
), ),
), ),
), ),
// Display a real-time graph of positive and negative data
const SizedBox(height: 32), const SizedBox(height: 32),
const Padding(
padding: EdgeInsets.all(16.0),
child: Text(
'Supports negative values :',
),
),
SizedBox( SizedBox(
width: MediaQuery.of(context).size.width, width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.width * 0.8, height: MediaQuery.of(context).size.width * 0.8,
@ -80,7 +99,9 @@ class _MyHomePageState extends State<MyHomePage> {
), ),
), ),
), ),
const SizedBox(height: 32),
// Display a real-time graph of positive and negative data as points
SizedBox( SizedBox(
width: MediaQuery.of(context).size.width, width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.width * 0.8, height: MediaQuery.of(context).size.width * 0.8,

View File

@ -1,3 +1,5 @@
library real_time_chart;
export 'src/chart_display.dart'; export 'src/chart_display.dart';
export 'src/point.dart'; export 'src/point.dart';
export 'src/live_chart.dart'; export 'src/real_time_chart.dart';

View File

@ -1,7 +1,7 @@
name: real_time_chart name: real_time_chart
description: Real-Time Chart. description: A Flutter package for displaying real-time charts with flexible customization options.
version: 0.0.1 version: 0.0.1
homepage: homepage: https://github.com/tajaouart/real_time_chart
environment: environment:
sdk: '>=2.19.2 <3.0.0' sdk: '>=2.19.2 <3.0.0'
@ -16,39 +16,5 @@ dev_dependencies:
sdk: flutter sdk: flutter
flutter_lints: ^2.0.0 flutter_lints: ^2.0.0
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter packages.
flutter: flutter:
# To add assets to your package, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
#
# For details regarding assets in packages, see
# https://flutter.dev/assets-and-images/#from-packages
#
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware
# To add custom fonts to your package, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts in packages, see
# https://flutter.dev/custom-fonts/#from-packages