fiet_charts 0.1.0
fiet_charts: ^0.1.0 copied to clipboard
A FIET chart project.
example/lib/main.dart
import 'package:fiet_charts/fiet_charts.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Chart Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const HomeScreen(),
);
}
}
class HomeScreen extends StatefulWidget {
const HomeScreen({Key? key}) : super(key: key);
@override
State<HomeScreen> createState() => _HomeScreenState();
}
class _HomeScreenState extends State<HomeScreen> {
@override
Widget build(BuildContext context) {
Size size = MediaQuery.of(context).size;
var labelStyle = TextStyle(color: Colors.black, fontSize: 16);
return Scaffold(
appBar: AppBar(
title: const Text('Chart Demo'),
),
body: Column(
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
width: size.width,
height: 300,
padding: const EdgeInsets.only(right: 20),
child: CustomPaint(
painter: BarChart(
primaryYAxis: YAxis(
max: 3000,
yAxisGrid: [
GridLine(value: 0, name: "0", textStyle: labelStyle),
GridLine(value: 3000, name: "3K", textStyle: labelStyle),
GridLine(
value: 1500, name: "1.5K", textStyle: labelStyle),
GridLine(
value: 2300,
name: "2.3K",
color: Color.fromARGB(255, 109, 208, 213)),
],
),
dataXLabel: [
TextSpan(text: "일"),
TextSpan(text: "월"),
TextSpan(
text: "화",
style:
TextStyle(color: Colors.deepPurple, fontSize: 16)),
TextSpan(text: "수"),
TextSpan(text: "목"),
TextSpan(text: "금"),
TextSpan(text: "토"),
],
dataSource: <double>[500, 2100, 2300, 2100, 1400, 2700, 2000],
dotIndex: [3, 4],
),
),
),
]),
);
}
}