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

화면 20. Graph.pointLabel [sink]

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

화면 번호20 / 29
문서 항목 설명 (원문)Sets a label for a point. This only works for points defined like A=(1,2), and the identifier needs to match the name given to the point (A in this case). Takes a string. The label next to the point exactly matches the provided string, so the label is turned off if the empty string is provided.

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

화면 20 캡처

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

2. CL이 입력된 곳

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

번호이름종류CL 코드 원문, 번역, 설명
1pointLabelGraph그래프
# For any named point in the graph, we can define the label using a string of text.
# For LaTex, ensure that the text is surrounded by backticks ``. Labels can only be
# one type of font. Either all LaTex or all regular font. Size and orientation of
# the point label can be set in the graph.
▷ 그래프에서 이름 붙은 점은 글자로 라벨을 정할 수 있다. LaTeX를 쓰려면 글자를 백틱 ``으로 감싸야 한다. 라벨은 LaTeX 전체 또는 일반 글꼴 전체 중 한 가지만 쓸 수 있다. 점 라벨의 크기와 방향은 그래프에서 정할 수 있다.

pointLabel("a"): 
  when pointLabelInput.submitted "`${pointLabelInput.latex}`"
  when this.number("s_{uccess}") > 0.95 "🔥"
  when this.number("s_{uccess}") > 0.75 "🥵"
  when this.number("s_{uccess}") > 0.50 "😎"
  when this.number("s_{uccess}") > 0    "🥶"
  otherwise ""
▶ 점 a의 라벨(pointLabel)은 학생이 pointLabelInput을 제출했다면(pointLabelInput.submitted) 입력한 식의 LaTeX 글자를 수식으로 표시한 것("`${pointLabelInput.latex}`")으로, 아니면 this.number("s_{uccess}")가 0.95보다 크면 🔥, 0.75보다 크면 🥵, 0.50보다 크면 😎, 0보다 크면 🥶, 모두 아니면 빈 글자(라벨 없음)로 한다.
when은 조건을 위에서부터 확인해 처음 맞는 값을 쓴다. pointLabelInput.latex는 pointLabelInput에 입력한 식의 LaTeX 글자이고, 글자 안의 백틱(`)은 그 부분을 수식 모양으로 표시하게 한다.
2레이블 없는 메모메모
# Some variables are created to help organize the possible
# prompt and feedback messages.
▷ 안내 문구와 피드백 문구를 정리하기 위해 몇 가지 변수를 만든다.
prompt0 = "Drag the point to help you find the mystery number.\n\n"
▶ 변수 prompt0은 "Drag the point to help you find the mystery number.\n\n"(비밀 숫자를 찾는 데 도움이 되도록 점을 끌어 옮기시오.)로 한다.
글자 끝의 \n\n은 줄바꿈 두 번(빈 줄)이다.
prompt1 = "Then enter your guess below." ▶ 변수 prompt1은 "Then enter your guess below."(그런 다음 아래에 추측한 값을 입력하시오.)로 한다. feedbackLow = "Just a little bit under!" ▶ 변수 feedbackLow는 "Just a little bit under!"(아주 조금 모자란다!)로 한다. feedbackHigh = "Just a little bit over!" ▶ 변수 feedbackHigh는 "Just a little bit over!"(아주 조금 넘친다!)로 한다. feedbackCorrect = "Nice job!" ▶ 변수 feedbackCorrect는 "Nice job!"(잘했다!)로 한다. error = "Hmmm... Something's not quite right. Try a different number." ▶ 변수 error는 "Hmmm... Something's not quite right. Try a different number."(음... 뭔가 맞지 않는다. 다른 숫자를 입력해 보시오.)로 한다. # Displays different combinations of the prompt and the feedback. ▷ 안내 문구와 피드백을 여러 방식으로 조합해 표시한다. content: # only display the prompt when the input is not submitted. ▷ 입력이 제출되지 않았을 때만 안내 문구를 표시한다. when not(pointLabelInput.submitted) "${prompt0}${prompt1}" # Display the too high, too low, or just right feedback. ▷ 너무 높음, 너무 낮음, 딱 맞음 피드백을 표시한다. when pointLabelInput.numericValue < pointLabelGraph.number("m_{ysteryNumber}") "${prompt0}${feedbackLow}" when pointLabelInput.numericValue > pointLabelGraph.number("m_{ysteryNumber}") "${prompt0}${feedbackHigh}" when pointLabelInput.numericValue = pointLabelGraph.number("m_{ysteryNumber}") "${prompt0}${feedbackCorrect}" # If there is an issue with the number entered, display the error message. ▷ 입력한 숫자에 문제가 있으면 오류 메시지를 표시한다. otherwise "${prompt0}${error}" ▶ 메모의 내용(content)은 입력을 아직 제출하지 않았다면(not(pointLabelInput.submitted)) prompt0과 prompt1을 이은 글자로, 제출했다면 입력값(pointLabelInput.numericValue)이 비밀 숫자(pointLabelGraph.number("m_{ysteryNumber}"))보다 작으면 prompt0 뒤에 feedbackLow를, 크면 feedbackHigh를, 같으면 feedbackCorrect를 붙인 글자로, 어느 쪽도 아니면 prompt0 뒤에 error를 붙인 글자로 한다.
when은 조건을 위에서부터 확인해 처음 맞는 값을 쓴다. ${prompt0}${prompt1}처럼 ${ }는 변수의 값을 글자 안에 끼워 넣는 표기이다.