Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 90262

Add a single data point to a series and specify its properties in VBA

$
0
0

Background

I'm receiving StdOut from python in and parsing the information so I have a set have N many (x,y) coordinates belonging to M many series. I would like to be able to plot each point individually and control for their respective properties I.e color, shape, marker size, etc.

However, all the examples I have seen so far involve having to plot all the values at once and then loop through the series. My desired functionality would look like the below pseudocode.

.SeriesCollection(seriesNumber).AddPoint(PtNum).xvalues = x
.SeriesCollection(seriesNumber).AddPoint(PtNum).values = y
.SeriesCollection(seriesNumber).Point(PtNum).markersize = some integer

Further Details

The data I'm receiving from python follows this format, stored as a variant.

SeriesName, Point# in the series, X or O, SeriesNumber, xcoord,ycoord, instance number

O represents there needs to be a new series, X represents an already existing series

instance number is the number of times a point was repeated

Point# Is the point index of a coordinate in the series

Example lines of data

series1,1,O,1,0.25,64,1
series1,2,X,1,0.25,64,2
series2,1,O,2,0.3,90,1

Current Code

    Dim pyData() As Variant

    pyData = Connect_2py.recv_Data(xArgs, yArgs, seriesArgs) 'exec python script and returns data
    For i = 0 To UBound(pyData) - 1

        py_lineData = Split(pyData(i), ",")
        createSeries = StrComp(py_lineData(2), "O", vbBinaryCompare) = 0
        seriesName = py_lineData(0)
        seriesNumber = CInt(py_lineData(3))

        If createSeries Then
            .SeriesCollection.NewSeries
            .SeriesCollection(seriesNumber).Name = seriesName
            Debug.Print ("Hooray new series has been made")
        End If

       'ENTER CODE HERE TO ADD EACH DATAPOINT TO A SPECIFIED SERIES
    Next

Viewing all articles
Browse latest Browse all 90262

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>