Articles in this section
Category / Section

How to Customize the Flutter SparkBarChart (SfSparkBarChart)?

5 mins read

This article explains how to customize the Flutter Spark bar charts (SfSparkBarChart).

The SfSparkBarChart widget renders spark bar type series. Here, we'll explore options to customize the highest, lowest, negative, first, last point colors, and axis crossing.

Initially, declare and initialize the SfSparkBarChart widget and bind the data source.

The following article explains about how to bind the data source in different ways to the spark charts widget.

https://support.syncfusion.com/kb/article/10813/how-to-bind-data-to-the-flutter-sparkline-chart-sfsparklinechart

The color property is used to customize the appearance of the bar chart.

 SfSparkBarChart.custom(
 // Renders the bar series in the red color
  color: Colors.red.withOpacity(0.5),
),

 

Screenshot

 

Spark_bar_color

 

 

Using the firstPointColor and lastPointColor properties, customize the appearance of first and last point colors of the bar chart, respectively.

 SfSparkBarChart.custom(
  // First point alone renders in red color
  firstPointColor: Colors.red,
  // Last point alone renders in yellow color
  lastPointColor: Colors.yellow,
),

 

Screenshot

 

First_last_point_color

 

Using the lowPointColor and highPointColor properties, customize the appearance of the  lowest and highest point colors of the bar chart, respectively.

 SfSparkBarChart.custom(
  // Low point alone renders in red color.
  lowPointColor: Colors.red,
  // High point alone renders in yellow color.
  highPointColor: Colors.yellow,
),

 

Screenshot

 

High_low_point_color

 

Use the negativePointColor property to customize the appearance of negative values alone.

 SfSparkBarChart.custom(
  // Negative points alone render in red color.
  negativePointColor: Colors.red,
  ),

 

Screenshot

 

Negative_point_color

 

By default, the axis position is rendered at the minimum y-axis value. Using the axis-crossing feature, you can customize the axis to the required position. To render the axis at a particular position, use the axisCrossesAt property:

 SfSparkBarChart.custom(
  // Axis will be rendered at where y-value as 10.
  axisCrossesAt: 10
  ),

 

Screenshot

 

 

Axis_crossing

 

View the Github Sample here.

 


Conclusion

I hope you enjoyed learning about how to customize the Flutter SparkBarChart (SfSparkBarChart).

You can refer to our Flutter Spark Bar Chart feature tour page to learn about its other groundbreaking feature representations and documentation, to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied