Exemple #1
0
# Now we read the data from the table into arrays
timeStamps = rantable.getCol(0)
highData = rantable.getCol(1)
lowData = rantable.getCol(2)
openData = rantable.getCol(3)
closeData = rantable.getCol(4)
volData = rantable.getCol(5)

# Create a FinanceChart object of width 720 pixels
c = FinanceChart(720)

# Add a title to the chart
c.addTitle("Finance Chart Demonstration")

# Disable default legend box, as we are using dynamic legend
c.setLegendStyle("normal", 8, Transparent, Transparent)

# Set the data into the finance chart object
c.setData(timeStamps, highData, lowData, openData, closeData, volData,
          extraDays)

# Add the main chart with 240 pixels in height
c.addMainChart(240)

# Add a 10 period simple moving average to the main chart, using brown color
c.addSimpleMovingAvg(10, 0x663300)

# Add a 20 period simple moving average to the main chart, using purple color
c.addSimpleMovingAvg(20, 0x9900ff)

# Add candlestick symbols to the main chart, using green/red for up/down days
# Now we read the data from the table into arrays
timeStamps = rantable.getCol(0)
highData = rantable.getCol(1)
lowData = rantable.getCol(2)
openData = rantable.getCol(3)
closeData = rantable.getCol(4)
volData = rantable.getCol(5)

# Create a FinanceChart object of width 720 pixels
c = FinanceChart(720)

# Add a title to the chart
c.addTitle("Finance Chart Demonstration")

# Disable default legend box, as we are using dynamic legend
c.setLegendStyle("normal", 8, Transparent, Transparent)

# Set the data into the finance chart object
c.setData(timeStamps, highData, lowData, openData, closeData, volData, extraDays)

# Add the main chart with 240 pixels in height
c.addMainChart(240)

# Add a 10 period simple moving average to the main chart, using brown color
c.addSimpleMovingAvg(10, 0x663300)

# Add a 20 period simple moving average to the main chart, using purple color
c.addSimpleMovingAvg(20, 0x9900ff)

# Add candlestick symbols to the main chart, using green/red for up/down days
c.addCandleStick(0x00ff00, 0xff0000)