Skip to main content

l10

alt

import 'package:d_chart/d_chart.dart';
import 'package:flutter/material.dart';
List<NumericData> series1 = [
NumericData(domain: -1, measure: 20, other: '01-02'),
NumericData(domain: 1, measure: 20, other: '03-07'),
NumericData(domain: 2, measure: 90, other: '10-14'),
NumericData(domain: 3, measure: 70, other: '17-21'),
NumericData(domain: 4, measure: 120, other: '24-28'),
NumericData(domain: 5, measure: 120, other: '29-30'),
];
AspectRatio(
aspectRatio: 16 / 9,
child: DChartLineN(
configRenderLine: ConfigRenderLine(
strokeWidthPx: 2.5,
),
layoutMargin: LayoutMargin(20, 10, 20, 10),
domainAxis: DomainAxis(
numericViewport: const NumericViewport(0.5, 4.5),
useGridLine: true,
gridLineStyle: LineStyle(
color: Colors.grey.shade200,
),
tickLength: -6,
tickLineStyle: const LineStyle(
color: Colors.black45,
thickness: 2,
),
gapAxisToLabel: 10,
tickLabelFormatterN: (domain) {
final data = series1.where((e) => e.domain == domain).firstOrNull;
return data?.other ?? '$domain';
},
labelStyle: const LabelStyle(
color: Colors.black54,
),
),
measureAxis: const MeasureAxis(
numericViewport: NumericViewport(0, 150),
noRenderSpec: true,
),
groupList: [
NumericGroup(
id: '1',
data: series1,
color: Colors.deepPurple,
),
],
),
),