relu_plot_lib 1.0.6 copy "relu_plot_lib: ^1.0.6" to clipboard
relu_plot_lib: ^1.0.6 copied to clipboard

A simple graph tool for flutter desktop applications which allows for drawing of multiple graphs.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:relu_plot_lib/relu_plot_lib.dart';

void main() {
  runApp(const MyApp());
}

/// This is an example app showing a simple example on how relu_plot_lib can be used.
class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'relu_plot_lib demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'relu_plot_lib demo'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: Center(
          child: Padding(
              padding: const EdgeInsets.all(10),
              child: Plot(
                xTicks: Ticks(
                  pretty: true,
                  logarithmic: true,
                  unit: 'Hz',
                  fractionDigits: 1,
                ),
                yTicks: Ticks(pretty: true, logarithmic: false, unit: 'dB'),
                graphs: [
                  Graph(
                      x: List<double>.generate(10000, (i) => i + 1.0),
                      y: List<double>.generate(10000, (i) => i + 1.0),
                      color: Colors.blue,
                      crosshairs: [
                        Crosshair(
                          width: 120,
                          label: 'Crosshair',
                          yPadding: 20,
                          color: Colors.red,
                        )
                      ],
                      annotations: [
                        Annotation(
                          width: 100,
                          height: 100,
                          child: const Card.filled(
                            color: Colors.red,
                            child: SizedBox(
                              width: 100,
                              height: 70,
                              child: Center(
                                  child: Text(
                                'This is an annotation!',
                                textAlign: TextAlign.center,
                              )),
                            ),
                          ),
                        ),
                      ]),
                ],
              ))),
    );
  }
}
1
likes
160
points
50
downloads

Publisher

verified publisherrelu.no

Weekly Downloads

A simple graph tool for flutter desktop applications which allows for drawing of multiple graphs.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, test, vector_math

More

Packages that depend on relu_plot_lib