Does anyone have any sample code for using the ChartJS feature in VB
There are heaps of examples in html and C# but I just can’t seem to get the syntax for displaying in VB
Thank you
Andrew
Hi Gareth,
I presume you have a sample that “almost” works but is missing some bits. What is the precise issue?
Hi Tiago
Yes that’s about right.
I’ve got the majority working and have run chartjs before in a html panel in similar software to wisej (visual web gui) but wisej has an inbuilt control that would be neater to use.
The main issue is the syntax for the data, label and background color functionality.
I woild be grateful for any sample code or examples as it doesn’t seem to follow standard syntax
Thanks again.
Hi Gareth,
I presume you are familiar with ChartJS example in the GitHub repository. Didn’t it help you?
[Edit]
Please note also the https://wisej.com/support/question/chartjs-data-set-is-not-displayed-in-the-new-project thread and how the issue was solved.
Here is some sample vb.net code
Imports System
Imports Wisej.Web
Imports System.Drawing
Public Class Window1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim data() As Object = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}
Dim colors() = {Color.Green, Color.Red, Color.Blue, Color.Orange, Color.DarkOrange, Color.DarkRed, _
Color.LightBlue, Color.LightGray, Color.Purple, Color.WhiteSmoke, Color.Blue, Color.BlueViolet}
Dim labels() As String = {“Jan”, “Feb”, “Mar”, “Apr”, “May”, “Jun”, “Jul”, “Aug”, “Sep”, “Nov”, “Dec”}
Dim ds As New Wisej.Web.Ext.ChartJS.BarDataSet
ds.Data = data
ds.BackgroundColor = colors
ds.Label = “Status”
chart.ChartType = Ext.ChartJS.ChartType.Bar
chart.Options.Scales.xAxes(0).Type = Ext.ChartJS.ScaleType.Category
chart.Labels = labels
chart.DataSets.Add(ds)
chart.UpdateData()
End Sub
End Class
Please login first to submit.