WebChart uses case

I would greatly appreciate whoever explains to me how to get a graph with two different arrays inside the object.

I experimented with the three above:
WebChart.AddDataset
WebChart.AddDatasets
WebChart.AddDataAt

None of these documented in XOJO Documentation.

In the video WEB2 presentation, they give us a superposition example, but it does not work in the new versión.

https://documentation.xojo.com/api/user_interface/web/webchart.html

You must use the WebChartCircularDataset, WebChartLinearDataset and WebChartScatterDataset subclasses.

Have you tried adding, for example, 2 superposed WebChartLinearDatasets to a linear chart?

Thanks, Rick. I think I did not explain well.

My program already does the graphics very well. But I don’t know how to make two charts in one.

In this video, you can see the Income and Expense graph in the same chart. Skip at minute 12:18.

Examples - Web - Controls - Chart.xojo_binary_project shows 2 datasets.

Go to 11:20 and follow there the entire construction.

Notice adding a new dataset as I said before:

Rick, did you try to do this?

Nope. I asked you to try it.

I did it, but it doesn’t work.

Thanks Alberto !!!

I’m not able to help it here right now, because I don’t have R2 here now. If someone else could confirm, then WebChart have issues and needs a report.

Code that solved my problem:

// First set of data
Var data(2) As Double
data(0) = 5
data(1) = 7
data(2) = 10
data.Add(15)
data.Add(2)
data.Add(24)

Var mySet As New WebChartLinearDataset(“Bar Data”, &cFF0000, True, data)
mySet.ChartType = WebChartLinearDataset.ChartTypes.Bar
Me.AddDataset(mySet)

// Second set of data
Var data2() As Double

For i As Integer = 1 To 6
data2.Add(System.Random.InRange(5, 40))
Next

Var myset2 As New WebChartLinearDataset(“Line Data”, &c0000FF, True, data2)
myset2.ChartType = WebChartLinearDataset.ChartTypes.Line
Me.AddDataset(myset2)

Me.AddLabels(“January”, “February”, “March”, “April”, “May”, “June”)

Thanks Rick !!!

1 Like

That’s basically what I showed from the video. Two datasets. :slightly_smiling_face:

My mistake was using the same data for both graph set.

:frowning:

Sorry Rick…

1 Like