What’s Coming in 2018 Volume 1: Xamarin.Forms Chart | Syncfusion Blogs
Live Chat Icon For mobile
Live Chat Icon
Popular Categories.NET  (172).NET Core  (29).NET MAUI  (192)Angular  (107)ASP.NET  (51)ASP.NET Core  (82)ASP.NET MVC  (89)Azure  (40)Black Friday Deal  (1)Blazor  (209)BoldSign  (12)DocIO  (24)Essential JS 2  (106)Essential Studio  (200)File Formats  (63)Flutter  (131)JavaScript  (219)Microsoft  (118)PDF  (80)Python  (1)React  (98)Streamlit  (1)Succinctly series  (131)Syncfusion  (882)TypeScript  (33)Uno Platform  (3)UWP  (4)Vue  (45)Webinar  (49)Windows Forms  (61)WinUI  (68)WPF  (157)Xamarin  (161)XlsIO  (35)Other CategoriesBarcode  (5)BI  (29)Bold BI  (8)Bold Reports  (2)Build conference  (8)Business intelligence  (55)Button  (4)C#  (146)Chart  (125)Cloud  (15)Company  (443)Dashboard  (8)Data Science  (3)Data Validation  (8)DataGrid  (62)Development  (613)Doc  (7)DockingManager  (1)eBook  (99)Enterprise  (22)Entity Framework  (5)Essential Tools  (14)Excel  (37)Extensions  (22)File Manager  (6)Gantt  (18)Gauge  (12)Git  (5)Grid  (31)HTML  (13)Installer  (2)Knockout  (2)Language  (1)LINQPad  (1)Linux  (2)M-Commerce  (1)Metro Studio  (11)Mobile  (488)Mobile MVC  (9)OLAP server  (1)Open source  (1)Orubase  (12)Partners  (21)PDF viewer  (41)Performance  (12)PHP  (2)PivotGrid  (4)Predictive Analytics  (6)Report Server  (3)Reporting  (10)Reporting / Back Office  (11)Rich Text Editor  (12)Road Map  (12)Scheduler  (52)Security  (3)SfDataGrid  (9)Silverlight  (21)Sneak Peek  (31)Solution Services  (4)Spreadsheet  (11)SQL  (10)Stock Chart  (1)Surface  (4)Tablets  (5)Theme  (12)Tips and Tricks  (112)UI  (368)Uncategorized  (68)Unix  (2)User interface  (68)Visual State Manager  (2)Visual Studio  (30)Visual Studio Code  (17)Web  (577)What's new  (313)Windows 8  (19)Windows App  (2)Windows Phone  (15)Windows Phone 7  (9)WinRT  (26)

What’s Coming in 2018 Volume 1: Chart in Xamarin.Forms

Syncfusion is excited to announce that we have enhanced our most popular Xamarin chart control with a new chart type and many most requested features in the upcoming 2018 Volume 1 release. They are: gradient color support, legend items templating, customization of individual axis labels, new spline range area chart type, and performance improvements.

Gradient colors—It’s time to make the chart more stylish with gradient colors. We have constructed models to define gradient colors, allowing you to customize the direction of gradient colors using start and end points and set the color based on the range. The following screenshot shows how the high and low temperatures of the year are differentiated with colors.


The following are code snippets of gradient color configuration.

XAML

    
        
            
                
                    
                    
                
            
        
    
 

C#

chart.ColorModel.Palette = ChartColorPalette.Custom;
chart.ColorModel.CustomGradientColors = new ChartGradientColorCollection()
{ 
	new ChartGradientColor()
    {
        StartPoint = new Point(0.5, 1),
        EndPoint = new Point(0.5, 0),
        GradientStops = new ChartGradientStopCollection(){
        new ChartGradientStop(){ Color = Color.FromHex("#3649FE"), Offset = 0},
        new ChartGradientStop(){ Color = Color.FromHex("#FF0D09"), Offset = 1}
		}
    }
};

Advanced customization of axis labels—This feature allows us to customize chart axis labels based on the indexes and values. We have included appearance customization APIs for the existing LabelCreated EventArgs. The following screenshot has been captured from the test app, the date-time axis labels are customized based on date, the first label of the month is formatted with month, day, and year components of date, and consecutive labels on the month are just showing the day of the month.

 Advanced customization of axis label

The following is a code snippet of individual axis customization.

int month = int.MaxValue;
//Label created event of primary axis.
//chart.PrimaryAxis.LabelCreated += PrimaryAxis_LabelCreated;
private void PrimaryAxis_LabelCreated(object sender, ChartAxisLabelEventArgs e)
{
    //Parse the date time label to date object.
    var date = DateTime.Parse(e.LabelContent);
    if (date.Month != month)
    {
        //Format the date to display day, month and year component if the label is very first label of the month.
        e.LabelContent = date.ToString("\t\t\t\t\t\tdd\nMMM-yyyy");
        //Reset the month
        month = date.Month;
        //Set the font attribute as bold to differentiate with other labels.
        e.LabelStyle = new ChartAxisLabelStyle();
        e.LabelStyle.Font = Font.SystemFontOfSize(9, FontAttributes.Bold);
    }
    else
    {
        //Format the label to show only day of the month for remaining label.
        e.LabelContent = date.ToString("dd");
    }
}

Templating legend items—Now, we can set a data template for legend items, replacing the entire built-in legend item view with the data template. We can make the necessary bindings in a data template with the respective legend item’s value.

The following is a code snippet of a legend template.

    
        
            
                
                    
                    
                    
                
            
        
    
 

Note: The complete sample will be available in our Xamarin.Forms sample browser after the 2018 Volume 1 release.

New chart type – We have added a new chart type called spline range area in this release, this is used to show the trend of high and low values of data using curved area. This chart type is similar to range area chart.

Code snippet of spline range area series.

XAML

    
    

C#

chart.Series.Add(
    new SplineRangeAreaSeries
    {
        Label = "Product A",
        ItemsSource = ProductA,
        XBindingPath = "XValue",
        High = "High",
        Low = "Low"
    });


chart.Series.Add(
    new SplineRangeAreaSeries
    {
        Label = "Product B",
        ItemsSource = ProductB,
        XBindingPath = "XValue",
        High = "High",
        Low = "Low"
    });

Performance—The performance of interactivity in charts with a large amount of data has been improved. Now, it is easy to move the trackball across the chart, activate the tooltip to show data point info, and zoom in to view data clearly when there’s 500K data points.

With the above features and improvements, we have included some other minor improvements and bug fixes, the information for which will be published in our release notes. Our 2018 Volume 1 release has been scheduled to rollout in mid-February. Please post your comments below if you have any questions or feedback. We are happy to offer any help we can.

Tags:

Share this post:

Popular Now

Be the first to get updates

Subscribe RSS feed
Scroll To Top