oscilloscope 0.0.3

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • new62

oscilloscope widget package for Flutter

Oscilloscope is a graphical display similar to the trace on an oscilloscope that will display values as it scrolls across the screen. The widget uses a List <double> as the source of the data to display and will scale the information to fit the display. Take a look at the example to see how it can be used.

Each time a value is added to the dataset another point is plotted on the trace, this trace will extends from left to right across the screen until it reaches the end. At this point the trace will then scroll to show new values.

The display can be customised using the following values:

  • backgroundColor - the default is Colors.black
  • traceColor - the default color is Colors.white
  • padding - the default is 10.0
  • showYAxis - show or hide a line representing the 0 yAxis (default is false)
  • yAxisColor - if the yAxis is set for display it will show in this color (default is Colors.white)

The other settings are

  • dataSet - this is the data that is used to generate the trace
  • yAxisMin - an indicator to define the minimum value found in the dataSet (default 0.0)
  • yAxisMax - an indicator to define the maximum value found in the dataSet (default 1.0)

yAxisMin and yAxisMax are used by the widget to determine the scaling factor so all data values are displayed. These values can be altered to modify the data display scale.

Getting Started

For package install see here.

For help getting started with Flutter, view the online documentation.

[0.0.3] - 14 Sept 2018.

[0.0.2] - 14 Sept 2018.

  • Added optional yAxis line

[0.0.1] - 13 Sept 2018.

  • Initial Release

example/lib/main.dart

/// Demo of using the oscilloscope package
///
/// In this demo 2 displays are generated showing the outputs for Sine & Cosine
/// The scope displays will show the data sets  which will fill the yAxis and then the screen display will 'scroll'
import 'package:flutter/material.dart';
import 'package:oscilloscope/oscilloscope.dart';
import 'dart:math';
import 'dart:async';

void main() => runApp(new MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: "Oscilloscope Display Example",
      home: Shell(),
    );
  }
}

class Shell extends StatefulWidget {
  @override
  _ShellState createState() => _ShellState();
}

class _ShellState extends State<Shell> {
  List<double> traceSine = List();
  List<double> traceCosine = List();
  double radians = 0.0;
  Timer _timer;

  /// method to generate a Test  Wave Pattern Sets
  /// this gives us a value between +1  & -1 for sine & cosine
  _generateTrace(Timer t) {
    // generate our  values
    var sv = sin((radians * pi));
    var cv = cos((radians * pi));

    // Add to the growing dataset
    setState(() {
      traceSine.add(sv);
      traceCosine.add(cv);
    });

    // adjust to recyle the radian value ( as 0 = 2Pi RADS)
    radians += 0.05;
    if (radians >= 2.0) {
      radians = 0.0;
    }
  }

  @override
  initState() {
    super.initState();
    // create our timer to generate test values
    _timer = Timer.periodic(Duration(milliseconds: 60), _generateTrace);
  }

  @override
  void dispose() {
    _timer.cancel();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    // Create A Scope Display for Sine
    Oscilloscope scopeOne = Oscilloscope(
      showYAxis: true,
      yAxisColor: Colors.orange,
      padding: 20.0,
      backgroundColor: Colors.black,
      traceColor: Colors.green,
      yAxisMax: 1.0,
      yAxisMin: -1.0,
      dataSet: traceSine,
    );

    // Create A Scope Display for Cosine
    Oscilloscope scopeTwo = Oscilloscope(
      showYAxis: true,
      padding: 20.0,
      backgroundColor: Colors.black,
      traceColor: Colors.yellow,
      yAxisMax: 1.0,
      yAxisMin: -1.0,
      dataSet: traceCosine,
    );

    // Generate the Scaffold
    return Scaffold(
      appBar: AppBar(
        title: Text("OscilloScope Demo"),
      ),
      body: Column(
        children: <Widget>[
          Expanded(flex: 1, child: scopeOne),
          Expanded(
            flex: 1,
            child: scopeTwo,
          ),
        ],
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  oscilloscope: ^0.0.3

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

Alternatively, your editor might support flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:oscilloscope/oscilloscope.dart';
  
Version Uploaded Documentation Archive
0.0.3 Sep 14, 2018 Go to the documentation of oscilloscope 0.0.3 Download oscilloscope 0.0.3 archive
0.0.2 Sep 14, 2018 Go to the documentation of oscilloscope 0.0.2 Download oscilloscope 0.0.2 archive
0.0.1 Sep 13, 2018 Go to the documentation of oscilloscope 0.0.1 Download oscilloscope 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
29
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
62
Learn more about scoring.

We analyzed this package on Sep 18, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.12.3
  • Flutter: 0.8.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Suggestions

Package is pre-v0.1 release.

While there is nothing inherently wrong with versions of 0.0.*, it usually means that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test