#Region Project Attributes
#ApplicationLabel: MPMultiLineChartV3
#VersionCode: 3
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: landscape
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Private mlc1 As MultiLineChart
Private Button1 As Button
Dim flag As Int = 0
Private ImageView1 As ImageView
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("main")
ImageView1.Visible = False
mlc1.ChartDescription = "TITLE : Just some random data" 'SORTED OUT DISPLAY OF DESCRIPTION IF NO TITLE IS SET - 22 OCT 2015
mlc1.ChartDescriptionColor = Colors.Red
mlc1.ChartDescriptionTextSize = 15
mlc1.GridBackgroundColor = Colors.DarkGray
mlc1.LegendShapeSize = 10.0
mlc1.LegendTextColorsToMatchLineColors = True 'ADDED 25 Dec 2015
' RIGHT_OF_CHART, RIGHT_OF_CHART_CENTER, RIGHT_OF_CHART_INSIDE,
' LEFT_OF_CHART, LEFT_OF_CHART_CENTER, LEFT_OF_CHART_INSIDE,
' BELOW_CHART_LEFT, BELOW_CHART_RIGHT, BELOW_CHART_CENTER,
' CIRCLE, SQUARE, LINE
mlc1.setTheLegendPositionAndForm("BELOW_CHART_CENTER","SQUARE")
mlc1.LegendXEntrySpace = 35.0f 'ADDED 25 Dec 2015
mlc1.LegendYEntrySpace = 25.0f 'ADDED 25 DEc 2015
mlc1.TheLegendColor = Colors.White
mlc1.TheLegendTextSize = 10.0
mlc1.LegendText = Array As String("2011", "2012", "2013", "2014", "2015")
mlc1.ValueTextColor = Array As Int(Colors.White, Colors.Red, Colors.White, Colors.Red, Colors.White)
mlc1.ValueTextSize = Array As Float(12.0, 10.0, 14.0, 8.0, 16.0)
mlc1.YaxisTextSize = 10.0
mlc1.IgnoreZero = True
' We are going to draw 5 charts/graphs
mlc1.Chart_1_Data = Array As Float(10.0, 30.0, 20.0, 0, 40.0, 0, 45.0, -15.0, 38.3, 0.00001, 29.8, -15.7)
' mlc1.Chart_2_Data = Array As Float(1200.0, 750.0, 450.0, 960.0, 730.0, 1100.0, 676.5, 985.6, 1010.8, 836.4, 498.5, 965.3)
mlc1.Chart_2_Data = Array As Float(-10.0, 0, -20.0, 50.0, -40.0, 30.0, -45.0, 15.0, -38.3, 0, -29.8, 15.7)
' mlc1.Chart_4_Data = Array As Float(345.0, -380.2, -250.4, 849.7, 445.0, 600.5, -300.0, 50.0, 550.0, 1100.0, 894.2, 993.8)
mlc1.Chart_3_Data = Array As Float(40.0, 0, 50.0, -80.0, 0, 0, 75.0, -45.0, 0.00001, 0, 59.8, -45.7)
' 25 DEC 2015 - THE DEFAULT Y-AXIS FOR ALL LINE CHARTS HAS BEEN SET TO THE LEFT Y-AXIS
' Dim ad() As String = Array As String("RIGHT", "LEFT", "RIGHT", "LEFT", "RIGHT") 'NEW - ADDED Y AXIS DEPENDANCY - 22 OCT 2015
' mlc1.YaxisDependancy = ad 'NEW - ADDED Y AXIS DEPENDANCY - 22 OCT 2015
mlc1.DrawGraphValues = Array As Boolean(True, True, True, True, True)
mlc1.MaxVisibleValueCount = 20
' Maximum 5 colors to be passed ==> must be at least equal to the number of data sets that are passed i.e maximum 5
' If you pass only for eg 2 data sets then at least 2 colors need to be passed
' If more that 2 colors are passed with for eg only 2 data sets then only the first 2 colors will be used in the color array
mlc1.LineColors = Array As Int(Colors.Yellow, Colors.Red, Colors.Blue, Colors.Green, Colors.Cyan)
mlc1.GraphLineWidth = Array As Float(2.0, 3.0, 4.0, 5.0, 6.0)
mlc1.DrawFilled = Array As Boolean(False, False, False, False, False) 'BUG FIX - 25 DEC 2015
mlc1.FillColor = Array As Int(Colors.Yellow, Colors.Red, Colors.Blue, Colors.Green, Colors.Cyan) 'BUG FIX - 25 DEC 2015
mlc1.XaxisTextColor = Colors.Green
mlc1.XaxisTextSize = 12.0
mlc1.XaxisLables = Array As String("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")
' TOP, BOTTOM, BOTH_SIDED, TOP_INSIDE, BOTTOM_INSIDE
mlc1.XaxisLabelPosition = "TOP"
mlc1.XaxisTextAngle = 30 'NEW - 'AMENDED CODE TO SET THE ANGLE OF THE X AXIS LABELS BETWEEN -90 and 90 - 22 OCT 2015
mlc1.VerticalGridColor = Colors.White 'NEW - ADDED ABILITY TO SET THIS COLOR - 22 OCT 2015
mlc1.DrawXaxisGridLines = True
mlc1.DrawYaxisLeftGridLines = True 'NEW - ADDED 23 OCT 2015
mlc1.DrawYaxisRightGridLines = False 'NEW - ADDED 23 OCT 2015
mlc1.YaxisLeftMinVal = -100 'BUG FIX 25 DEC 2015 TO SET LEFT Y AXIS MIN VAL INDEPENDANTLY - comment it out so that the scale will be set automatically
mlc1.YaxisLeftMaxVal = 100 'AMENDED 22 OCT 2015 TO SET LEFT Y AXIS MAX VAL INDEPENDANTLY - comment it out so that the scale will be set automatically
' mlc1.YaxisRightMinVal = -175 'BUG FIX 25 DEC 2015 TO SET RIGHT Y AXIS MIN VAL INDEPENDANTLY - comment it out so that the scale will be set automatically
' mlc1.YaxisRightMaxVal = 175 'AMENDED 22 OCT 2015 TO SET RIGHT Y AXIS MAX VAL INDEPENDANTLY - comment it out so that the scale will be set automatically
mlc1.YaxisTextSize = 10.0
mlc1.YaxisLeftTextColor = Colors.Cyan 'NEW - ADDED 23 OCT 2015
mlc1.YaxisRightTextColor = Colors.Yellow 'NEW - ADDED 23 OCT 2015
mlc1.ShowYaxisRightLabels = False
mlc1.ShowYaxisLeftLabels = True
mlc1.DrawLeftGridDashed = False 'NEW - ADDED 23 OCT 2015
mlc1.DrawRightGridDashed = True 'NEW - ADDED 23 OCT 2015
mlc1.YaxisTextAngle = -15 'NEW - 'ADDED ABILITY TO SET THE ANGLE OF THE Y AXIS LABELS BETWEEN -90 and 90 - 22 OCT 2015
mlc1.HorizontalGridColorLeft = Colors.White 'NEW - 'ADDED ABILITY TO SET THIS COLOR - 22 OCT 2015
mlc1.HorizontalGridColorRight = Colors.Yellow 'NEW - 'ADDED ABILITY TO SET THIS COLOR - 22 OCT 2015
mlc1.CubicIntensity = Array As Float(0.2, 0.3, 0.3, 0.4, 0.5)
mlc1.DrawCubicGraph = Array As Boolean(True, True, True, False, True)
mlc1.DrawDashedLine = Array As Boolean(True, False, True, False, True)
mlc1.GraphCircleSize = Array As Float(4.0, 5.0, 6.0, 7.0, 8.0)
mlc1.GraphCircleColor = Array As Int(Colors.Red, Colors.Green, Colors.Magenta, Colors.Black, Colors.Blue)
mlc1.DrawGraphHollowCircles = Array As Boolean(True, False, True, False, True)
mlc1.MarkerToUse = 4
mlc1.XAnimate = False
mlc1.YAnimate = True
mlc1.ChartAnimationTime = 2000 'milliseconds
' the number of charts to be drawn (maximum 5, in this case 5)
' the number of x-axis values per chart (in this case 12 = number of elements in the array passed to mlc1.XaxisLables)
mlc1.setLineData(3,12)