← 수업 제작 도구
홈 › Components › Graph and Graphing Calc › 화면 16

화면 16. Graph.bounds [sink]

원본: Computation Layer 문서(Graph) · Try It (원본 화면)

화면 번호16 / 29
문서 항목 설명 (원문)Sets the bounds of the graph. Commonly used in combination with the "background" sink. This overrides user interaction, so we caution against using it with fullscreen graphs.

1. 화면 캡처 (빨간 번호 = 아래 표의 번호)

화면 16 캡처

화면에 적힌 영어 문구(원문):

2. CL이 입력된 곳

코드 안의 회색 줄은 원문 영어 주석이고, 파란 줄은 그 영어 주석의 번역이며, 연분홍 줄은 코드가 하는 일의 설명이다.

번호이름종류CL 코드 원문, 번역, 설명
1zoomGraph그래프
# Get variables from the graph that tell us
# the desired boundaries of the graph. Store
# those in Computation Layer variables.
▷ 그래프에서 원하는 경계를 알려 주는 변수들을 가져와 Computation Layer 변수에 저장한다.

xSmall = zoomGraph.number("x_{small}")
▶ 변수 xSmall은 그래프 zoomGraph의 변수 "x_{small}"의 값(zoomGraph.number("x_{small}"))으로 한다.
zoomGraph.number("x_{small}")는 그래프 zoomGraph 안의 변수 값을 읽어 온다.
xBig = zoomGraph.number("x_{big}") ySmall = zoomGraph.number("y_{small}") yBig = zoomGraph.number("y_{big}") ▶ 변수 xBig, ySmall, yBig는 xSmall과 같은 방식으로, 각각 그래프의 변수 "x_{big}", "y_{small}", "y_{big}"의 값으로 한다. # If "zoomButton" has been pressed, set the bounds of the # graph to be variables we have declared in the script. # Otherwise set the bounds to be a standard view. ▷ "zoomButton"이 눌렸다면 그래프의 경계를 스크립트에서 선언한 변수로 정한다. 눌리지 않았다면 표준 보기의 경계로 정한다. bounds: when zoomButton.timeSincePress > 0 makeBounds(xSmall, xBig, ySmall, yBig) otherwise makeBounds(-10,10,-10,10) ▶ 그래프의 경계(bounds)는 zoomButton.timeSincePress > 0이면 변수 xSmall, xBig, ySmall, yBig로 만든 범위(makeBounds(xSmall, xBig, ySmall, yBig)), 그 밖에는 x와 y 모두 -10부터 10까지(makeBounds(-10,10,-10,10))로 한다.
timeSincePress는 행동 버튼을 누른 뒤 지난 시간(초)을 알려 주며 재설정 링크를 누르거나 같은 화면의 구성요소를 선택하거나 편집하면 0으로 돌아간다. makeBounds(왼쪽, 오른쪽, 아래, 위)는 경계를 만들고, when은 조건을 차례로 확인해 처음 맞는 값을 쓴다.
2zoomButton행동 버튼
# Set the text of the reset label.
▷ 재설정(reset) 라벨의 글자를 정한다.

resetLabel: "Reset"
▶ 행동 버튼의 재설정 라벨(resetLabel)은 "Reset"(재설정)으로 한다.
학생이 버튼을 누른 뒤 다시 시작할 때 누르는 재설정 링크에 이 글자가 표시된다.