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

Xcode 10 iOS 12 - A JavaScript exception occurred

Open yumsmools opened this issue 6 years ago • 5 comments

Hi there,

Thanks for an awesome control. I'm having a slight problem since I switched to iOS 12. I keep getting the following error:

☠️☠️💀☠️☠️WARNING!!!!!!!!!!!!!!!!!!!! FBI WARNING !!!!!!!!!!!!!!!!!!!! WARNING☠️☠️💀☠️☠️
==========================================================================================
------------------------------------------------------------------------------------------
Error Domain=WKErrorDomain Code=4 "A JavaScript exception occurred" 
UserInfo={
WKJavaScriptExceptionLineNumber=1,
 WKJavaScriptExceptionMessage=SyntaxError: Unexpected identifier 'a'. Expected ')' to end an argument list., 
WKJavaScriptExceptionColumnNumber=0, 
WKJavaScriptExceptionSourceURL=file:///Users/imranmoolla/Library/Developer/CoreSimulator/Devices/4F5BBBF1-CA78-4DA4-9002-8BF3D66695F0/data/Containers/Bundle/Application/E65F0F8F-8B06-4E7A-B7BE-4FB88FAA5430/MySTC%20Store.app/AAJSFiles.bundle/AAChartView.html, 
NSLocalizedDescription=A JavaScript exception occurred
}
------------------------------------------------------------------------------------------
==========================================================================================
☠️☠️💀☠️☠️WARNING!!!!!!!!!!!!!!!!!!!! FBI WARNING !!!!!!!!!!!!!!!!!!!! WARNING☠️☠️💀☠️☠️

I have downloaded the latest Source and I'm using the source directly. Here is my code to use the chart:

                    let aaChartModel = AAChartModel.init()
                        .chartType(AAChartType.Bar)
                        .backgroundColor("#EBEBF1")
                        .animationType(AAChartAnimationType.Bounce)
                        .title("Agents / Orders Per City")
                        .dataLabelEnabled(false)
                        .legendEnabled(true)
                        .legendAlign(.Center)
                        .tooltipValueSuffix("")
                        .colorsTheme(["#824190", "#CC2A7A", "#E79B14"])
                        .categories(cityNames)
                        .series([
                            AASeriesElement()
                                .name("Agents")
                                .data(displayData.0)
                                .toDic()!,
                            AASeriesElement()
                                .name("Deliveries")
                                .data(displayData.1)
                                .toDic()!,
                            AASeriesElement()
                                .name("Unpicked")
                                .data(displayData.2)
                                .toDic()!,])
                        .xAxisReversed(true)
                    self.citiesChart.aa_drawChartWithChartModel(aaChartModel)

The data being used is the following set of arrays:

▿ 3 elements
  ▿ .0 : 38 elements
    - 0 : 15
    - 1 : 10
    - 2 : 1
    - 3 : 2
    - 4 : 1
    - 5 : 1
    - 6 : 1
    - 7 : 2
    - 8 : 1
    - 9 : 1
    - 10 : 0
    - 11 : 1
    - 12 : 0
    - 13 : 0
    - 14 : 1
    - 15 : 0
    - 16 : 0
    - 17 : 3
    - 18 : 2
    - 19 : 0
    - 20 : 2
    - 21 : 0
    - 22 : 0
    - 23 : 0
    - 24 : 0
    - 25 : 0
    - 26 : 0
    - 27 : 1
    - 28 : 0
    - 29 : 0
    - 30 : 0
    - 31 : 0
    - 32 : 1
    - 33 : 2
    - 34 : 0
    - 35 : 1
    - 36 : 1
    - 37 : 0
  ▿ .1 : 38 elements
    - 0 : 32
    - 1 : 21
    - 2 : 1
    - 3 : 5
    - 4 : 1
    - 5 : 1
    - 6 : 1
    - 7 : 3
    - 8 : 3
    - 9 : 1
    - 10 : 0
    - 11 : 1
    - 12 : 0
    - 13 : 0
    - 14 : 1
    - 15 : 0
    - 16 : 0
    - 17 : 4
    - 18 : 3
    - 19 : 0
    - 20 : 3
    - 21 : 0
    - 22 : 0
    - 23 : 0
    - 24 : 0
    - 25 : 0
    - 26 : 0
    - 27 : 1
    - 28 : 0
    - 29 : 0
    - 30 : 0
    - 31 : 0
    - 32 : 2
    - 33 : 2
    - 34 : 0
    - 35 : 1
    - 36 : 1
    - 37 : 0
  ▿ .2 : 38 elements
    - 0 : 155
    - 1 : 21
    - 2 : 18
    - 3 : 8
    - 4 : 3
    - 5 : 12
    - 6 : 7
    - 7 : 0
    - 8 : 10
    - 9 : 1
    - 10 : 6
    - 11 : 4
    - 12 : 9
    - 13 : 20
    - 14 : 11
    - 15 : 4
    - 16 : 2
    - 17 : 15
    - 18 : 2
    - 19 : 1
    - 20 : 1
    - 21 : 2
    - 22 : 2
    - 23 : 2
    - 24 : 1
    - 25 : 2
    - 26 : 1
    - 27 : 0
    - 28 : 1
    - 29 : 7
    - 30 : 2
    - 31 : 2
    - 32 : 0
    - 33 : 0
    - 34 : 1
    - 35 : 2
    - 36 : 5
    - 37 : 1

Thanks for any help you can provide

Imran

yumsmools avatar Oct 04 '18 08:10 yumsmools

I got same error. Any solution?

ismaiI1 avatar Dec 20 '18 10:12 ismaiI1

I got same error. Any solution?

Unfortunately not.
I've actually moved on from this, no response from the devs so we built our own

yumsmools avatar Dec 20 '18 10:12 yumsmools

I am also getting same error for function which works same way with same data but for few post it says like this

anveshfactorly avatar Mar 31 '20 07:03 anveshfactorly

I need urgent help on this

anveshfactorly avatar Mar 31 '20 07:03 anveshfactorly

Solution : Please make sure that there is no special character is added in the chart , in my case with name property (anny's) - aphostrophy S is added which cause the issue , i've debugged and fixed it

No special character's with XValues , YValues , or any other chart's property

Annyjain29 avatar Mar 31 '20 07:03 Annyjain29