Android Question Exception With Charts

Marcos Alves

Well-Known Member
Licensed User
Longtime User
Hello,

I'm getting the error message:

Error occurred on line: 394 (ChatSync)
android.content.res.Resources$NotFoundException: Resource ID #0x0
at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:195)
at android.content.res.Resources.loadXmlResourceParser(Resources.java:2133)
at android.content.res.Resources.getLayout(Resources.java:1142)
at android.view.LayoutInflater.inflate(LayoutInflater.java:421)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)

when calling the method Chart1.LineData = DataSize using @Johan Schoeman library described here: https://www.b4x.com/android/forum/t...chart-bar-chart-line-chart.57760/#post-363539

I double checked the declarations and didn't find any error... anybody can help me? The code is:

B4X:
    Chart1.LegendShapeSize = 7.0        'this line of code needs to be before mlc1.setTheLegendPositionAndForm("BELOW_CHART_CENTER", "CIRCLE")
    Chart1.setTheLegendPositionAndForm("BELOW_CHART_CENTER", "CIRCLE")    'pass strings from the above comments
    
    Chart1.TheLegendColor = Colors.Yellow
    Chart1.TheLegendTextSize = 17.0
    Chart1.LegendTitle = "Some Data"
    
    Chart1.ChartDescription = "Teste"
    Chart1.ChartDescriptionColor = Colors.Blue
    Chart1.ChartDescriptionTextSize = 15
    
    Chart1.ValueTextColor = Colors.White
    Chart1.ValueTextSize = 12.0
    
    Chart1.LegendText = LegendArray
    Chart1.ChartData = ValueArray
    
    Chart1.DoubleTapToZoomEnabled = True
    Chart1.GridBackgroundColor = Colors.LightGray
    Chart1.DrawBorders = True
    Chart1.DrawGridBackground = True
    Chart1.PinchZoom = True
    Chart1.ScaleEnabled = True
    Chart1.BorderColor = Colors.DarkGray
    Chart1.BorderWidth = 1.0
    Chart1.DrawDashedLine = False
    Chart1.DrawGraphHollowCircles = True
    
    Chart1.DrawGraphValues = False
    Chart1.GraphCircleSize = 2.0
    Chart1.GraphCircleColor = Colors.Yellow
    Chart1.DrawAxisLine = True   
    Chart1.DrawXaxisGridLines = True
    Chart1.DrawYaxisGridLines = True   
    Chart1.GraphLineColor = Colors.DarkGray
    Chart1.GraphLineWidth = 2.0
    
    'TOP, BOTTOM, BOTH_SIDED, TOP_INSIDE, BOTTOM_INSIDE
    Chart1.XaxisLabelPosition = "BOTH_SIDED"
    Chart1.XaxisTextColor = Colors.White
    Chart1.XaxisTextSize = 10.0
    
    Chart1.YaxisTextColor = Colors.White
    Chart1.YaxisTextSize = 10.0
    Chart1.DrawCubicGraph = True
    Chart1.CubicIntensity = 0.3
    Chart1.CrossHairColor = Colors.Red
    Chart1.YaxisMinVal = 0
    Chart1.YaxisMaxVal = MaxY           
    Chart1.DrawFilled = True
    Chart1.FillColor = Colors.Green
    
    Chart1.ShowYaxisLeftLabels = True
    Chart1.ShowYaxisRightLabels = False
    
    Chart1.MarkerToUse = 2

    Chart1.ScaleXEnabled = True
    Chart1.ScaleYEnabled = False
    
    Chart1.LineData = DataSize

Thanks!
 

Johan Schoeman

Expert
Licensed User
Longtime User
Hello,

I'm getting the error message:

Error occurred on line: 394 (ChatSync)
android.content.res.Resources$NotFoundException: Resource ID #0x0
at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:195)
at android.content.res.Resources.loadXmlResourceParser(Resources.java:2133)
at android.content.res.Resources.getLayout(Resources.java:1142)
at android.view.LayoutInflater.inflate(LayoutInflater.java:421)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)

when calling the method Chart1.LineData = DataSize using @Johan Schoeman library described here: https://www.b4x.com/android/forum/t...chart-bar-chart-line-chart.57760/#post-363539

I double checked the declarations and didn't find any error... anybody can help me? The code is:

B4X:
    Chart1.LegendShapeSize = 7.0        'this line of code needs to be before mlc1.setTheLegendPositionAndForm("BELOW_CHART_CENTER", "CIRCLE")
    Chart1.setTheLegendPositionAndForm("BELOW_CHART_CENTER", "CIRCLE")    'pass strings from the above comments
  
    Chart1.TheLegendColor = Colors.Yellow
    Chart1.TheLegendTextSize = 17.0
    Chart1.LegendTitle = "Some Data"
  
    Chart1.ChartDescription = "Teste"
    Chart1.ChartDescriptionColor = Colors.Blue
    Chart1.ChartDescriptionTextSize = 15
  
    Chart1.ValueTextColor = Colors.White
    Chart1.ValueTextSize = 12.0
  
    Chart1.LegendText = LegendArray
    Chart1.ChartData = ValueArray
  
    Chart1.DoubleTapToZoomEnabled = True
    Chart1.GridBackgroundColor = Colors.LightGray
    Chart1.DrawBorders = True
    Chart1.DrawGridBackground = True
    Chart1.PinchZoom = True
    Chart1.ScaleEnabled = True
    Chart1.BorderColor = Colors.DarkGray
    Chart1.BorderWidth = 1.0
    Chart1.DrawDashedLine = False
    Chart1.DrawGraphHollowCircles = True
  
    Chart1.DrawGraphValues = False
    Chart1.GraphCircleSize = 2.0
    Chart1.GraphCircleColor = Colors.Yellow
    Chart1.DrawAxisLine = True 
    Chart1.DrawXaxisGridLines = True
    Chart1.DrawYaxisGridLines = True 
    Chart1.GraphLineColor = Colors.DarkGray
    Chart1.GraphLineWidth = 2.0
  
    'TOP, BOTTOM, BOTH_SIDED, TOP_INSIDE, BOTTOM_INSIDE
    Chart1.XaxisLabelPosition = "BOTH_SIDED"
    Chart1.XaxisTextColor = Colors.White
    Chart1.XaxisTextSize = 10.0
  
    Chart1.YaxisTextColor = Colors.White
    Chart1.YaxisTextSize = 10.0
    Chart1.DrawCubicGraph = True
    Chart1.CubicIntensity = 0.3
    Chart1.CrossHairColor = Colors.Red
    Chart1.YaxisMinVal = 0
    Chart1.YaxisMaxVal = MaxY         
    Chart1.DrawFilled = True
    Chart1.FillColor = Colors.Green
  
    Chart1.ShowYaxisLeftLabels = True
    Chart1.ShowYaxisRightLabels = False
  
    Chart1.MarkerToUse = 2

    Chart1.ScaleXEnabled = True
    Chart1.ScaleYEnabled = False
  
    Chart1.LineData = DataSize

Thanks!
There are files in the /Objects/res/layout and /Objects/res/drawable folder of the project that you dont have in your project or they got deleted when you compiled your B4A project because the property of the files was not set to Read Only. Make sure you have the files in those folders and set them to Read Only
 
Upvote 0

Marcos Alves

Well-Known Member
Licensed User
Longtime User
There are files in the /Objects/res/layout and /Objects/res/drawable folder of the project that you dont have in your project or they got deleted when you compiled your B4A project because the property of the files was not set to Read Only. Make sure you have the files in those folders and set them to Read Only
Thanks! Fixed!
 
Upvote 0

Marcos Alves

Well-Known Member
Licensed User
Longtime User
There are files in the /Objects/res/layout and /Objects/res/drawable folder of the project that you dont have in your project or they got deleted when you compiled your B4A project because the property of the files was not set to Read Only. Make sure you have the files in those folders and set them to Read Only
Hi!

By the way... I noticed that my Y axis legend is drawn with one decimal position... (1.0 2.0) . As my graphic has only integer, I would like to draw 1 2 ... and so on. How can I configure this?
 
Upvote 0

Johan Schoeman

Expert
Licensed User
Longtime User
Hi!

By the way... I noticed that my Y axis legend is drawn with one decimal position... (1.0 2.0) . As my graphic has only integer, I would like to draw 1 2 ... and so on. How can I configure this?
Try and set this to 0 (cannot remember if I allowed for using 0

B4X:
chrtChart.YaxisLeftNumberOfDigits = 1
chrtChart.YaxisRightNumberOfDigits = 3
 
Upvote 0
Top