Categorical data visualization with multiple variations
final data = [ {'quarter': 'Q1', 'revenue': 120}, {'quarter': 'Q2', 'revenue': 150}, {'quarter': 'Q3', 'revenue': 110}, {'quarter': 'Q4', 'revenue': 180}, ]; CristalyseChart() .data(data) .mapping(x: 'quarter', y: 'revenue') .geomBar( width: 0.8, alpha: 0.9, borderRadius: BorderRadius.circular(4), ) .scaleXOrdinal() .scaleYContinuous(min: 0) .theme(ChartTheme.defaultTheme()) .build()
final productData = [ {'quarter': 'Q1', 'revenue': 120, 'product': 'Widget A'}, {'quarter': 'Q2', 'revenue': 150, 'product': 'Widget A'}, {'quarter': 'Q1', 'revenue': 80, 'product': 'Widget B'}, {'quarter': 'Q2', 'revenue': 110, 'product': 'Widget B'}, ]; CristalyseChart() .data(productData) .mapping(x: 'quarter', y: 'revenue', color: 'product') .geomBar( style: BarStyle.grouped, width: 0.8, alpha: 0.9, ) .scaleXOrdinal() .scaleYContinuous(min: 0) .theme(ChartTheme.defaultTheme()) .build()
final budgetData = [ {'department': 'Marketing', 'amount': 50, 'category': 'Personnel'}, {'department': 'Marketing', 'amount': 30, 'category': 'Technology'}, {'department': 'Marketing', 'amount': 20, 'category': 'Travel'}, {'department': 'Sales', 'amount': 80, 'category': 'Personnel'}, {'department': 'Sales', 'amount': 25, 'category': 'Technology'}, ]; CristalyseChart() .data(budgetData) .mapping(x: 'department', y: 'amount', color: 'category') .geomBar( style: BarStyle.stacked, width: 0.8, alpha: 0.9, ) .scaleXOrdinal() .scaleYContinuous(min: 0) .theme(ChartTheme.defaultTheme()) .build()
final departmentData = [ {'department': 'Engineering', 'headcount': 45}, {'department': 'Product', 'headcount': 25}, {'department': 'Sales', 'headcount': 35}, {'department': 'Marketing', 'headcount': 20}, {'department': 'Customer Success', 'headcount': 15}, ]; CristalyseChart() .data(departmentData) .mapping(x: 'department', y: 'headcount') .geomBar( borderRadius: BorderRadius.circular(4), borderWidth: 1.0, ) .coordFlip() // Makes it horizontal .scaleXOrdinal() .scaleYContinuous(min: 0) .theme(ChartTheme.defaultTheme()) .build()
CristalyseChart() .data(data) .mapping(x: 'category', y: 'value') .geomBar( borderRadius: BorderRadius.circular(8), alpha: 0.8, ) .build()
CristalyseChart() .data(data) .mapping(x: 'category', y: 'value') .geomBar( borderWidth: 2.0, alpha: 0.7, ) .build()
CristalyseChart() .data(data) .mapping(x: 'category', y: 'value') .geomBar( color: Colors.deepPurple, alpha: 0.8, ) .build()
CristalyseChart() .data(data) .mapping(x: 'category', y: 'value') .geomBar() .animate( duration: Duration(milliseconds: 1200), curve: Curves.easeInOutCubic, ) .build()
CristalyseChart() .data(data) .mapping(x: 'category', y: 'value') .geomBar() .animate( duration: Duration(milliseconds: 1400), curve: Curves.elasticOut, ) .build()
final mixedData = [ {'quarter': 'Q1', 'revenue': 120, 'efficiency': 85}, {'quarter': 'Q2', 'revenue': 150, 'efficiency': 92}, {'quarter': 'Q3', 'revenue': 110, 'efficiency': 78}, ]; CristalyseChart() .data(mixedData) .mapping(x: 'quarter', y: 'revenue') .mappingY2('efficiency') .geomBar(yAxis: YAxis.primary) // Revenue bars .geomLine( yAxis: YAxis.secondary, // Efficiency line strokeWidth: 3.0, color: Colors.orange, ) .scaleXOrdinal() .scaleYContinuous(min: 0) .scaleY2Continuous(min: 0, max: 100) .build()
CristalyseChart() .data(data) .mapping(x: 'quarter', y: 'revenue') .geomBar() .interaction( tooltip: TooltipConfig( builder: (point) { return Container( padding: EdgeInsets.all(8), decoration: BoxDecoration( color: Colors.black.withOpacity(0.8), borderRadius: BorderRadius.circular(4), ), child: Text( '${point.getDisplayValue('quarter')}: \$${point.getDisplayValue('revenue')}k', style: TextStyle(color: Colors.white), ), ); }, ), ) .build()
CristalyseChart() .data(data) .mapping(x: 'quarter', y: 'revenue') .geomBar() .interaction( click: ClickConfig( onTap: (point) { print('Clicked: ${point.data}'); // Navigate to detail view showQuarterDetails(point.data); }, ), ) .build()
Bar Width
Color Choices
Stacked Bars
Performance