ChartJS and VB

0
0

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

  • You must to post comments
0
0

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

  • You must to post comments
0
0

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.

  • You must to post comments
0
0

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.

  • You must to post comments
0
0

Hi Gareth,

I presume you have a sample that “almost” works but is missing some bits. What is the precise issue?

  • Gareth Bond
    Having failed to get the ChartJS working in VB, I thought I would just add a html panel and try that. The html is… Funding Type Funding Type var ctx = document.getElementById(“Chart”).getContext(‘2d’); var Chart = new Chart(ctx, { type: ‘pie’, data: { labels : [“DP”], datasets: [{ label: ‘Funding Types’, data : [100], backgroundColor: [ ‘rgba(255, 164, 0, 0.8)’ ], borderColor: [ ‘rgba(255, 164, 0, 0.8)’ ], borderWidth: 1 }] }, options: { scales: { yAxes: [{ ticks: { beginAtZero:true } }] } } }); Can’t get that to work either. I have tested it in a html editor and it works fine just not in the WiseJ html panel Anyone got any ideas?
  • Tiago (ITG)
    If you attach the “almost working” sample, we can help you solve the standing issues.
  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.