FusionCharts Suite XT is a straightforward JavaScript charting library that can be integrated into virtually any framework, programming language, or application that generates an Interactive Graph. VB.NET is a well-known object-oriented programming language based on the.NET framework.
For rendering charts created using FusionCharts in VB.NET and Windows-based applications, we can use one of the following three methods:
In this post, we’ll cover up a tutorial that talks about integrating FusionCharts Suite XT with VB.NET and Windows-based form applications.
Table of Contents
We need the following applications installed before rendering FusionCharts in VB.NET and Windows-based applications:
dim html As New StringBuilder
html.Append("")
html.Append("")
html.Append("")
html.AppendFormat("", Application.StartupPath.Replace("\\", "/"))
html.Append("")
html.Append("FusionCharts.ready(function () {")
html.Append("var revenueChart = new FusionCharts({")
html.Append("type: 'column2d',")
html.Append("renderAt: 'chart-container',")
html.Append("width: '500',")
html.Append("height: '200',")
html.Append("dataFormat: 'xml',")
html.Append("dataSource: "" <chart caption='Monthly' xAxisName='Month' yAxisName='Revenue' numberPrefix='$' showValues='0'><set label='Jan' value='420000' /><set label='Feb' value='910000' /><set label='Mar' value='720000' /><set label='Apr' value='550000' /><set label='May' value='810000' /><set label='Jun' value='510000' /><set label='Jul' value='680000' /><set label='Aug' value='620000' /><set label='Sep' value='610000' /><set label='Oct' value='490000' /><set label='Nov' value='530000' /><set label='Dec' value='330000' /></chart> "" ")
html.Append("});")
html.Append("revenueChart.render();")
html.Append("});")
html.Append("")
html.Append("")
html.Append("")
html.Append("<div id='chart-container' align='center'></div>")
html.Append("")
html.Append("")
WebBrowser1.DocumentText = html.ToString()
<!DOCTYPE html>
<html lang="en" xmlns="https://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>Rendering FusionCharts</title>
<script src="https://static.fusioncharts.com/code/latest/fusioncharts.js"></script>
<script>
FusionCharts.ready(function () {
var cSatScoreChart = new FusionCharts({
type: 'angulargauge',
renderAt: 'chart-container',
width: '400',
height: '300',
dataFormat: 'json',
dataSource: {
"chart": {
"caption": "Average Customer Satisfaction Score",
"subcaption": "Last year vs Current year",
"lowerLimit": "0",
"upperLimit": "100",
"gaugeFillMix": "{dark-40},{light-40},{dark-20}",
"theme": "fint",
"majorTMAlpha": "0",
"minorTMAlpha": "0"
},
"colorRange": {
"color": [
{
"minValue": "0",
"maxValue": "50",
"code": "#e44a00"
},
{
"minValue": "50",
"maxValue": "75",
"code": "#f8bd19"
},
{
"minValue": "75",
"maxValue": "100",
"code": "#6baa01"
}
]
},
"dials": {
"dial": [
{
"value": "78",
"showValue": "1",
"tooltext": "Current year's average : $value",
"rearExtension": "15"
}
]
}
}
}).render();
});
</script>
</head>
<body>
<div id="chart-container">FusionCharts will render here</div>
</body>
</html>
WebBrowser1.Navigate(AppDomain.CurrentDomain.BaseDirectory.Replace("bin\Debug\", "HTMLPage1.html"))
Imports System.Text
Imports FusionCharts.Charts
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim Data As String
Data = "<chart caption='Sales of Liquor' subcaption='Last week' xaxisname='Day' yaxisname='Sales (In USD)' numberprefix='$' palettecolors='#0075c2' bgcolor='#ffffff' showborder='0' showcanvasborder='0' plotborderalpha='10' useplotgradientcolor='0' plotfillalpha='50' showxaxisline='1' axislinealpha='25' divlinealpha='10' showvalues='1' showalternatehgridcolor='0' captionfontsize='14' subcaptionfontsize='14' subcaptionfontbold='0' tooltipcolor='#ffffff' tooltipborderthickness='0' tooltipbgcolor='#000000' tooltipbgalpha='80' tooltipborderradius='2' tooltippadding='5'><set label='Mon' value='4123' /><set label='Tue' value='4633' /><set label='Wed' value='5507' /><set label='Thu' value='4910' /><set label='Fri' value='5529' /><set label='Sat' value='5803' /><set label='Sun' value='6202' /></chart>"
Dim factoryOutput As New Chart("area2d", "myChart", "600", "350", "xml", Data)
Dim Total As New StringBuilder
Total.Append("<html xmlns='https://www.w3.org/1999/xhtml'>")
Total.Append("<head>")
Total.Append("<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />")
Total.AppendFormat("<script type='text/javascript' src='https://static.fusioncharts.com/code/latest/fusioncharts.js?cacheBust=8232'></script>", Application.StartupPath.Replace("\\", "/"))
Total.Append("<body>")
Dim chartdata As String
chartdata = factoryOutput.Render()
Total.Append(chartdata)
Total.Append("</body>")
Total.Append("</html>")
WebBrowser1.DocumentText = Total.ToString()
End Sub
End Class If you find any difficulty in rendering the chart or you see any error in your code, click here to download the complete source code of the sample project we have created for this tutorial.
In case something went wrong, and you are unable to see the chart, check for the following:
A well-designed dashboard helps users understand complex data quickly, monitor key performance indicators, and make…
Quick Answer: The best commercial chart libraries for Nuxt include FusionCharts, Highcharts, AnyChart, amCharts, ApexCharts,…
Quick Answer To integrate interactive Vue charts into a Vue 3 application, first create a…
If you're looking for the best Vue chart library for interactive data visualization, there isn't…
Modern web applications generate and display more data than ever. They create from business dashboards…
Businesses collect data from multiple sources every day, including sales platforms, marketing tools, customer support…
View Comments
Hi,
I'm trying to use the real-time line chart in vb.net. How can I get a reference to the chart in order to send updates.
Thanks,
John