AAChartKit-Swift icon indicating copy to clipboard operation
AAChartKit-Swift copied to clipboard

How can I access custom data arguments when displaying more than 1000 points in a series?

Open meirinberg opened this issue 4 months ago β€’ 0 comments

During my development, I noticed that a series will not appear if it contains more than 1000 datapoints when constructed using a dictionary list ( [[String : Any]] ). However, if one passes a list of the (x, y) coordinate points directly, with no key, ( [[Double, Double]] ) then there is no 1000 datapoint limit. However, I need to pass/access data for use in a custom callback in addition to the coordinate points. When using the dictionary, this is easy as I can use the associated key. Unfortunately, when there is no key, and the x and y values are inferred, I don't know how to access the other data I am providing.

Using the dictionary (limited to 1000):

-----------πŸ–¨πŸ–¨πŸ–¨ console log AAOptions JSON information of AAChartView πŸ–¨πŸ–¨πŸ–¨-----------:
...
        {
          "x" : 1711051200000,
          "y" : 0.44,
          "customData1" : "77A705DB-6501-49EA-9CAB-EEAB58EDAA2D",
          "customData2" : "D7CA67BD-3B69-448F-9A8D-38687AB035A4"
        },
...

Using a basic list (no limit):

-----------πŸ–¨πŸ–¨πŸ–¨ console log AAOptions JSON information of AAChartView πŸ–¨πŸ–¨πŸ–¨-----------:
...
        {
          1711051200000,
          0.44,
          "77A705DB-6501-49EA-9CAB-EEAB58EDAA2D",
          "D7CA67BD-3B69-448F-9A8D-38687AB035A4"
        },
...

Thus, I see that my data is accessible in either form, but without the key I don't know how to grab it in my callback:

            aaOptions.plotOptions?.series?.point(AAPoint()
                .events(AAPointEvents()
                    .mouseOver(#"""
                    function() {
                            let message = {
                            name: this.series.name,
                            x: this.x,       // ---> assignment has been inferred from the basic list's 0th index
                            y: this.y,       // ---> assignment has been inferred from the basic list's 1st index
                            category: this.category,
                            offset: {
                                plotX: this.plotX,
                                plotY: this.plotY
                            },
                            index: this.index,
                            customData1: this.customData1 || "",
                            customData2: this.customData2 || ""         // ---> this.customData1 and this.customData2 do not exist when using the basic list. Have they been assigned elsewhere in the 'this' object? 
                            };
                        window.webkit.messageHandlers.selection.postMessage(message);
                    }
                    """#)))

Thank you again for your support.

meirinberg avatar Oct 15 '24 20:10 meirinberg