Adds a chart line to aNewXY chart. Function has four parameters, but only the first two parameters are required.
First parameter is a BPV data series, Second parameter is the element count of the first parameter's data series.
Two optional parameters are, Title and Color. Title will be the name displayed with the series, and Color will determine the color if its value isn't assigned the default value of "-1". Leaving the Color parameter blank will lets the chart automatically designate an unused color.
BPV: test.currentDay property reports last series element index.
IPV: instrument.bar property reports last series element index.
[Title]
Parameter is a text field. Name entered will be used as the name for the line series label. If the name option is not used, the name of the data series name is used.
[Color]
A color value of: -1 - will uses the chart's automatic color assignment.
See ColorRGB and the Colors for information on how to use other colors.
Example - 1:
' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ' LINE CHART EXAMPLE ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ' Establish Scatter Chart image size iChartWidth=500' X-Axis Width iChartHeight=300' Y-Axis Height ' Create a image chart.NewXY("Line Chart Example",iChartWidth,iChartHeight) ' Size the Scatter Dot Ploting area chart.SetPlotArea(30,30,40,50) ' Generate Blue Color Number ColorValue1=ColorRGB(255,0,0) ' Generate Green Color Number ColorValue2=ColorRGB(0,255,0) ' Generate Red C0lor Number ColorValue3=ColorRGB(0,0,255) ' Add Line data series 1 chart.AddLineSeries(AsSeries(Line1),100,"Line1",ColorValue1) ' Add Line data series 2 chart.AddLineSeries(AsSeries(Line2),100,"Line2",ColorValue2) ' Add Line data series 3 chart.AddLineSeries(AsSeries(Line3),100,"Line3",ColorValue3) ' Create & Save this new chart as a file. ' Always add a backSlash Character after "resultsReportPath" chart.Make(test.resultsReportPath+"\"+"LineChartExample.png") ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Returns - 1:
3-Line Chart Example:
Click to Enlarge; Click to Reduce.
Example - 2:
' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ' Create a chart area that is 80-Pixels wide, and 500-Pixels high chart.NewXY("System Equity Curves", iChartWidth, iChartHeight ) ' Number of data points to place on the chart elementCount =test.currentDay ' Place a scale label identifying the vertical scale information chart.SetAxisTitles("","Percent Gain/Loss") ' Set X-Axis Dates to use beginning of month chart.SetxAxisDates(AsSeries(DateSeries), elementCount, 4) ' Plot a Black line at the chart's Y-Axis Zero location chart.AddLineSeries(AsSeries( systemEquity ), elementCount,"", 0 ) ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ' Examine each system in the Simulation Suite For systemIndex = 1 TOtest.systemCount ' Access each system in the suite test.SetAlternateSystem( systemIndex ) ' Capture the daily exchange net equity rate change of ' ' each system in the Suite For i = 1 TO elementCount ' Calculate the total equity net percentage change between ' ' Test dates and store that information in a BPV system equity series. systemEquity[i]=(alternateSystem.totalEquity[ elementCount - i ] _ /alternateSystem.totalEquity[ elementCount - 1 ]- 1 )* 100 Next' i ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ' Assign each system net rate change to a specific color plotColor = ColorItem[ systemIndex ] 'OR ' Consider a random number color assignment ' BLUE GREEN RED 'plotColor = ColorRGB( Random(255), Random(255), Random(255) ) ' Place this system's test-date total equity percentage net change ' value in the chart space using the new color chart.AddLineSeries(AsSeries(systemEquity), elementCount, _ alternateSystem.name, plotColor ) Next' systemIndex ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ' When all the system's equity changes are display as new chart ' lines, save the image information as a file. chart.Make( sFilePath2 ) ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~