グラフの系列値を取得または設定します。系列名はSeries.Nameプロパティで設定します。
- 構文
- Series.Values
- 引数
- 戻り値
Series オブジェクトを返す可能性のあるメソッド・プロパティ
プログラム実行例
気象庁のホームページから一月分の気温を取得しExcelでグラフを作成
CONST xlUp = -4162
CONST xlLineMarkers = 65
DIM year = 2020
DIM month = 8
DIM IE = IEBoot()
IE.Navigate("https://www.data.jma.go.jp/obd/stats/etrn/view/daily_s1.php?prec_no=14&block_no=47412&year=" + year + "&month=" + month + "&day=&view=p1")
BusyWait(IE)
DIM array[-1][-1]
DIM element = IE.document.getElementById("tablefix1")
getTableData(element, array)
IE.Quit
DIM Excel = XLOPEN()
DIM SheetName = Excel.ActiveSheet.Name
XLSETDATA(Excel, array, "A1")
DIM row = Excel.Cells(Excel.Rows.Count, 1).End(xlUp).Row
DIM Charts = Excel.Charts.Add
WITH Charts
.ChartType = xlLineMarkers
.SeriesCollection.NewSeries
.HasTitle = TRUE
.ChartTitle.Text = "札幌 " + year + "年" + month + "月気温"
WITH .FullSeriesCollection(1)
.XValues = "=Sheet1!$A$5:$A$35"
.Name = "=<#DBL>最高気温<#DBL>"
.Values = "=Sheet1!$H$5:$H$35"
WITH .Format
.Fill.ForeColor.RGB = 255
.Line.ForeColor.RGB = 255
ENDWITH
ENDWITH
WITH .FullSeriesCollection(2)
.XValues = "=Sheet1!$A$5:$A$35"
.Name = "=<#DBL>最高気温<#DBL>"
.Values = "=Sheet1!$I$5:$I$35"
WITH .Format
.Fill.ForeColor.RGB = 16711680
.Line.ForeColor.RGB = 16711680
ENDWITH
ENDWITH
ENDWITH
//////////////////////////////////////////////////
// 【引数】
// IE : IEオブジェクト
// 【戻値】
//
//////////////////////////////////////////////////
PROCEDURE BusyWait(Var IE)
SLEEP(0.500)
DIM t = GETTIME()
TRY
REPEAT
DIM tm = GETTIME() - t
FUKIDASI("BusyWait:" + tm)
SLEEP(0.010)
IF tm >= 60 THEN BREAK
UNTIL !IE.Busy AND IE.readyState = 4
EXCEPT
IE = getIEObj(-1)
PRINT IE.document.URL + " のIEオブジェクトを取得しました。"
BusyWait(IE)
ENDTRY
FUKIDASI()
FEND
//////////////////////////////////////////////////
// 【引数】
// 文字列 or 数値 : 取得したいIEオブジェクトのタイトル・URLもしくは数値を指定
// 完全一致フラグ : (TRUE : 文字列が完全一致したものを取得、FALSE : 文字列の一部を含むものを取得)
// 【戻値】
// Internet Explorerオブジェクト
//////////////////////////////////////////////////
FUNCTION getIEObj(str, flg = FALSE)
DIM Shell = CREATEOLEOBJ("Shell.Application")
SELECT CHKNUM(str)
CASE TRUE
DIM cnt = 0
SELECT TRUE
CASE str > 0
FOR n = 0 TO Shell.Windows.Count - 1
TRY
IFB Shell.Windows.Item(n).Name = "Internet Explorer" THEN
cnt = cnt + 1
IFB str = cnt THEN
RESULT = Shell.Windows.Item(n)
EXIT
ENDIF
ENDIF
EXCEPT
ENDTRY
NEXT
CASE str = 5
SELEND
RESULT = ERR_VALUE
FEND
//////////////////////////////////////////////////
// 【引数】
// table : tableエレメント
// arr : 取得したデータを格納する配列(参照引数)
// 【戻値】
//
//////////////////////////////////////////////////
PROCEDURE getTableData(table, Var arr[][])
rowMax = table.rows.length - 1
colMax = 0
FOR row = 0 TO table.rows.length - 1
IFB table.rows(row).cells.length - 1 > colMax THEN
colMax = table.rows(row).cells.length - 1
ENDIF
NEXT
DIM arr[rowMax][colMax]
FOR row = 0 TO table.rows.length - 1
FOR col = 0 TO table.rows(row).cells.length - 1
n = 0
WHILE arr[row][col + n] ""
n = n + 1
WEND
arr[row][col + n] = table.rows(row).cells(col).innerText
IFB table.rows(row).cells(col).rowSpan > 1 AND table.rows(row).cells(col).colSpan > 1 THEN
rmax = table.rows(row).cells(col).rowSpan - 1
cmax = table.rows(row).cells(col).colSpan - 1
FOR r = 1 TO rmax
FOR c = 1 TO cmax
arr[row + r][col + c] = "←"
NEXT
NEXT
ENDIF
IFB table.rows(row).cells(col).rowSpan > 1 THEN
n = table.rows(row).cells(col).rowSpan - 1
WHILE n
arr[row + n][col] = "↑"
n = n - 1
WEND
ENDIF
IFB table.rows(row).cells(col).colSpan > 1 THEN
n = table.rows(row).cells(col).colSpan - 1
WHILE n
arr[row][col + n] = "←"
n = n - 1
WEND
ENDIF
NEXT
NEXT
FEND
//////////////////////////////////////////////////
// 【引数】
// InPrivate : InPrivateブラウズ・モードを有効にするときはTRUEを指定(デフォルトはFALSE)
// 【戻値】
// InternetExplorerオブジェクト
//////////////////////////////////////////////////
FUNCTION IEBoot(InPrivate = FALSE)
DIM IE
SELECT InPrivate
CASE TRUE
DOSCMD("start iexplore -private")
GETID("InPrivate - Internet Explorer - [InPrivate]", "IEFrame", -1)
IE = GETACTIVEOLEOBJ("InternetExplorer.Application","InPrivate - Internet Explorer - [InPrivate]")
CASE FALSE
TRY
IE = CREATEOLEOBJ("InternetExplorer.Application")
IE.Visible = TRUE
EXCEPT
EXEC("C:\Program Files\Internet Explorer\iexplore.exe")
GETID("Internet Explorer", "IEFrame", -1)
TRY
IE = GETACTIVEOLEOBJ("InternetExplorer.Application")
EXCEPT
IE = getIEObj(-1)
ENDTRY
ENDTRY
SELEND
RESULT = IE
FEND
- IEBoot
- Navigate
- BusyWait
- Document.getElementById メソッド
- getTableData
- XLOPEN
- Application.ActiveSheet プロパティ
- Worksheet.Name プロパティ
- XLSETDATA
- Application.Cells プロパティ
- Range.End プロパティ
- Range.Row プロパティ
- Application.Charts プロパティ
- Sheets.Add メソッド
- Excel.Charts
- Chart.ChartType プロパティ
- Chart.SeriesCollection メソッド
- Excel.SeriesCollection.NewSeries
- Series オブジェクト
- Chart.HasTitle プロパティ
- Chart.ChartTitle プロパティ
- Excel.ChartTitle.Text
- Excel.Chart.FullSeriesCollection
- FullSeriesCollection オブジェクト
- FullSeriesCollection.Item メソッド
- Series.XValues プロパティ
- Series.Name プロパティ
- Series.Values プロパティ
- Series.Format プロパティ
- FillFormat.ForeColor プロパティ
- Excel.ColorFormat.RGB
- Excel.LineFormat.FontColor
- 結果