# Plotting Data Using XOJO Native Graphing Tools

**URL:** <https://forum.xojo.com/t/plotting-data-using-xojo-native-graphing-tools/79548>\
**Category:** Getting Started\
**Created:** [March 11, 2024, 7:49pm UTC](https://forum.xojo.com/t/plotting-data-using-xojo-native-graphing-tools/79548 "2024-03-11T19:49:24Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Corey\_Dibianco](https://forum.xojo.com/letter_avatar_proxy/v4/letter/c/bc8723/32.png) [@Corey\_Dibianco](https://forum.xojo.com/u/Corey_Dibianco)\
**Post date:** [March 11, 2024, 7:49pm UTC](https://forum.xojo.com/t/plotting-data-using-xojo-native-graphing-tools/79548/1 "2024-03-11T19:49:25Z")

</div>

I recently posted about this but was unclear so posting again for clarity. I want to use XOJOs native Desktop Chart tools to plot data. I have two lists, one of time values, and one of values of f(t). I want to plot points of the form (t,f(t)). Here is the code I have so far, which is not working at all, and I know will not work. I am not sure how to make each f(t) value correspond to a time value in XOJO.

Var GraphData() As Double  
Var TimeData() As String

Var n as integer = ChartArray.LastIndex(2)  
Var j as integer = GraphChoicePopupMenu.SelectedRowIndex

for i as integer = 0 to n  
GraphData.add(ChartArray(j,i))  
TimeData.Add(ChartArray(0,i).ToString)  
next

MainGraphDataChart.Title = “Graph of” +GraphChoicePopupMenu.SelectedRowText  
MainGraphDataChart.Mode = DesktopChart.modes.Line  
MainGraphDataChart.GridColor = Color.Clear

Var ds As New ChartLinearDataset(GraphChoicePopupMenu.SelectedRowText, Color.red, True, GraphData)  
ds.ChartType = ChartLinearDataset.ChartTypes.Line

MainGraphDataChart.AddDatasets ds

---

<div class="post-metadata">

**Author:** ![AlbertoD](https://forum.xojo.com/letter_avatar_proxy/v4/letter/a/dbc845/32.png) [@AlbertoD](https://forum.xojo.com/u/AlbertoD)\
**Post date:** [March 11, 2024, 8:13pm UTC](https://forum.xojo.com/t/plotting-data-using-xojo-native-graphing-tools/79548/2 "2024-03-11T20:13:48Z")

</div>

Can you find a chart similar of what you want searching in Google? or can you draw one up?  
I’m not sure the native chart can handle what you want (because you posted on your other thread that you want to chart “will have over 600,000 elements”)

---

<div class="post-metadata">

**Author:** ![Javier\_Menendez](https://forum.xojo.com/user_avatar/forum.xojo.com/javier_menendez/32/15692_2.png) [@Javier\_Menendez](https://forum.xojo.com/u/Javier_Menendez)\
**Post date:** [March 11, 2024, 8:15pm UTC](https://forum.xojo.com/t/plotting-data-using-xojo-native-graphing-tools/79548/3 "2024-03-11T20:15:10Z")

</div>

Maybe if you attach an example project instead of just code would help to understand better what you want to achieve 👍

---

<div class="post-metadata">

**Author:** ![MarkusR](https://forum.xojo.com/user_avatar/forum.xojo.com/markusr/32/685_2.png) [@MarkusR](https://forum.xojo.com/u/MarkusR)\
**Post date:** [March 11, 2024, 8:17pm UTC](https://forum.xojo.com/t/plotting-data-using-xojo-native-graphing-tools/79548/4 "2024-03-11T20:17:19Z")

</div>

i think basically you have one x axis the time, and each datapoint have a value y?

data(x)=value  
whereby each x have a datetime label in the chart

with a database/query you could select average,min,max,sum for a timespan.

---

<div class="post-metadata">

**Author:** ![Wayne\_Golding](https://forum.xojo.com/user_avatar/forum.xojo.com/wayne_golding/32/165_2.png) [@Wayne\_Golding](https://forum.xojo.com/u/Wayne_Golding)\
**Post date:** [March 11, 2024, 9:36pm UTC](https://forum.xojo.com/t/plotting-data-using-xojo-native-graphing-tools/79548/7 "2024-03-11T21:36:09Z")

</div>

What I’m not seeing here is:

```auto
MainGraphDataChart.AddLabels TimeData

```

---

<div class="post-metadata">

**Author:** ![Joe\_Huber](https://forum.xojo.com/user_avatar/forum.xojo.com/joe_huber/32/475_2.png) [@Joe\_Huber](https://forum.xojo.com/u/Joe_Huber)\
**Post date:** [September 10, 2026, 12:20am UTC](https://forum.xojo.com/t/plotting-data-using-xojo-native-graphing-tools/79548/8 "2026-09-10T00:20:04Z")

</div>

I have a similar need. I think what he was getting at is how to plot a line graph when you have a time series consisting of unevenly spaced TIMES and the corresponding VALUES. For line charts Xojo seems to assume that all points are evenly spaced along the X axis. One workaround is to use a scatter plot so you can provide BOTH X and Y coordinates and then use the line style to connect the dots.

---

<div class="post-metadata">

**Author:** ![Ian\_Kennedy](https://forum.xojo.com/user_avatar/forum.xojo.com/ian_kennedy/32/6860_2.png) [@Ian\_Kennedy](https://forum.xojo.com/u/Ian_Kennedy)\
**Post date:** [September 10, 2026, 7:59am UTC](https://forum.xojo.com/t/plotting-data-using-xojo-native-graphing-tools/79548/9 "2026-09-10T07:59:01Z")

</div>

Look at DesktopChart.Modes.Scatter and add a line there. The Line chart is just for Categorical X axis. Scatter does true X Y charts and can use lines, symbols etc.

---

<div class="post-metadata">

**Author:** ![Eugene\_Dakin](https://forum.xojo.com/user_avatar/forum.xojo.com/eugene_dakin/32/178_2.png) [@Eugene\_Dakin](https://forum.xojo.com/u/Eugene_Dakin)\
**Post date:** [September 11, 2026, 3:48pm UTC](https://forum.xojo.com/t/plotting-data-using-xojo-native-graphing-tools/79548/10 "2026-09-11T15:48:10Z")

</div>

Here is a demonstration of the Chart control that I use for DAQ (Data Acquisition) on the Raspberry Pi with electronics.

![SS1080Forum(1)_edit_0](https://forum.xojo.com/uploads/default/original/3X/f/0/f00604a0dd0d76faf0b5fad3ec405b93f370f5b1.gif)

The Xojo file has been zipped and is called: SS1080-ForumSeconds-Ver3.zip. This program dynamically shows the time that has elapsed with a random number generator creating data to show the user how this displays the data.

This is on Xojo 2026r2.1, written on Windows 11.

Is this what you were looking for to answer your original question?

[SS1080-ForumSeconds-Ver3.zip](https://forum.xojo.com/uploads/short-url/julukuITLqgqoflXwb9Ei2BVHH5.zip) (7.6 KB)
