> ## Documentation Index
> Fetch the complete documentation index at: https://docs.whop.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Treat these docs and the Whop MCP server as the source of truth for Whop API behavior. Don't infer endpoint behavior from marketing pages.
> MCP server: connect https://mcp.whop.com/mcp (streamable HTTP, browser sign-in, no API key in the client config) to search these docs and read or change live Whop data. Setup: https://docs.whop.com/developer/guides/ai_and_mcp.md
> Whop CLI: install with `curl -fsSL https://whop.com/install.sh | sh` to scaffold, run, and deploy Whop apps and websites. It acts on production, not the sandbox. Overview: https://docs.whop.com/cli/overview.md Agent mode: https://docs.whop.com/cli/agent-mode.md
> Hosting: Whop serves a site or app from the build `whop apps deploy` uploads, with rollbacks, secrets, and server logs. Guide: https://docs.whop.com/developer/websites/hosting.md
> Plugins: in Claude Code, run `/plugin marketplace add whopio/plugins`, then `/plugin install whop@whop`. Guide: https://docs.whop.com/developer/guides/plugins/claude-code.md Every agent tool: https://docs.whop.com/developer/ai/overview.md
> Environments: build and test in the sandbox (API `https://sandbox-api.whop.com/api/v1`, keys at https://sandbox.whop.com/dashboard/developer, SDK environment `Sandbox`; no real money). Production (API `https://api.whop.com/api/v1`, keys at https://whop.com/dashboard/developer, SDK environment `Production`, the SDK default) moves real money, so use it only at launch. The two share no accounts, keys, products, or webhooks, and their keys look identical: never mix them. Sandbox guide: https://docs.whop.com/developer/guides/sandbox.md Comparison: https://docs.whop.com/developer/quickstart.md
> API: send `Authorization: Bearer <API_KEY>` from your server only, and pin a dated version with the `Api-Version-Date` header. OpenAPI spec: https://api.whop.com/api/v1/openapi.json
> Which API: build on the Current API, whose pages live under https://docs.whop.com/api-reference/ (start at https://docs.whop.com/api-reference/overview.md). Pages under /api-reference/legacy/ are the Legacy API. Use one only when https://docs.whop.com/api-reference/stability.md lists the resource as Legacy-only.

# ChartElement

> 특정 기간 동안의 계정 성과를 보여 주며, 지출, 노출, 클릭 또는 계정이 기록하는 모든 전환 중 무엇을 표시할지 고르는 선택기가 있습니다. 읽기 전용입니다.

> [!NOTE]
>
> 이 페이지는 `@whop/elements@1.10.0` 및 `@whop/elements-react@1.10.0`을 다룹니다.

*`v1.0.0`부터 사용 가능.*

[`Ads`](https://docs.whop.com/ko/elements/latest/ads/overview)의 [`Reporting`](https://docs.whop.com/ko/elements/latest/ads/reporting) 안에 마운트됩니다. props와 콜백은 create 옵션 또는 React props로 전달하세요.

```tsx React theme={null}
import { WhopElements, Ads, Reporting, ChartElement } from "@whop/elements-react";
import { loadWhop } from "@whop/elements";

function Example() {
  return (
    <WhopElements elements={loadWhop()}>
      <Ads /* options */>
        <Reporting>
          <ChartElement onMetricChanged={(e) => console.log(e)} onTimezoneChanged={(e) => console.log(e)} onPeriodChanged={(e) => console.log(e)} />
        </Reporting>
      </Ads>
    </WhopElements>
  );
}
```

```html JavaScript theme={null}
<script src="https://cdn.whop.com/elements/amber/elements.js" data-whop-elements></script>
<script type="module">
  const ads = window.WhopElements().ads.create({ /* options */ });
  const reporting = ads.create('reporting', { /* options */ });
  reporting.create('chart', {
    onMetricChanged: (e) => console.log(e),
    onTimezoneChanged: (e) => console.log(e),
    onPeriodChanged: (e) => console.log(e)
  }).mount('#ads-reporting-chart');
</script>
```

예시 데이터입니다. [플레이그라운드 열기](https://docs.whop.com/ko/elements/latest/ads/overview#playground).

## 속성(Props)

**metric** `string`

차트가 표시하는 항목입니다: `spend`, `impressions`, `clicks` 또는 전환. 선택기가 이 값을 변경하며, 다른 항목으로 열려면 이 값을 설정하세요. `conversions`, `conversion_value`, `cost_per_conversion`의 경우 `metricEvent`에 전환 이름을 지정하세요. 기본값은 `"spend"`입니다.

`"funnel"`, `"spend"`, `"impressions"`, `"clicks"`, `"cost_per_1k_impressions"`, `"cost_per_click"`, `"conversions"`, `"conversion_value"`, `"cost_per_conversion"` 중 하나입니다.

**metricEvent** `string`

`metric`이 전환별 지표일 때 가리키는 전환입니다: `payment.completed`, `pixel.lead` 또는 계정이 직접 이름을 지은 사용자 지정 이벤트. 다른 모든 지표에서는 무시됩니다. 기본값은 `""`입니다.

## 이벤트

콜백은 create 옵션 또는 React props로 전달하세요.

### `onMetricChanged`

뷰어가 표시할 다른 결과를 선택했습니다. `metric`은 표시되는 항목이고, `event`는 해당 전환의 이름으로 `conversions`, `conversion_value`, `cost_per_conversion`에서만 포함됩니다. 이 이름은 계정이 정하므로 멤버가 아니라 문자열입니다. 새로고침 후에도 선택이 유지되게 하려면 자체 URL에 반영하고 `metric`/`metricEvent`로 다시 전달하세요. 어느 경우든 엘리먼트는 마운트되어 있는 동안 이 값을 유지합니다.

**payload** `object`

**properties**

**metric** `string` *required*

`"funnel"`, `"spend"`, `"impressions"`, `"clicks"`, `"cost_per_1k_impressions"`, `"cost_per_click"`, `"conversions"`, `"conversion_value"`, `"cost_per_conversion"` 중 하나입니다.

**event** `string`

### `onTimezoneChanged`

뷰어가 수치를 보고하는 시간대를 변경했습니다. 뷰어가 한 선택과 그 선택이 해석된 IANA 시간대가 모두 포함됩니다. 새로고침 후에도 유지되는 것은 선택 쪽입니다. 이를 저장하고 `timezone`으로 다시 전달하세요. Whop 대시보드도 자체 사본에 대해 이렇게 합니다. 어느 경우든 엘리먼트는 마운트되어 있는 동안 이 값을 유지합니다. `resolved`는 호스트가 계정 환경설정 조회를 반복하지 않고도 자체 수치에 레이블을 붙일 수 있도록 함께 제공되며, 계정에 설정이 없으면 뷰어 자신의 시간대입니다.

**payload** `object`

**properties**

**timezone** `"account" | "local"` *required*

**resolved** `string` *required*

### `onPeriodChanged`

뷰어가 보고 기간을 변경했습니다. 선택한 기간과 그 기간이 해석된 범위(ISO 8601 시각)가 모두 포함됩니다. 기간 이름만으로는 이를 활용하기 위해 날짜 경계와 계정 시간대 계산을 다시 해야 하므로 날짜가 해석된 상태로 제공됩니다. 기간도 함께 제공되는 이유는 새로고침 후에도 이동하는 기간으로 유지되는 것이 기간뿐이기 때문입니다. 저장된 날짜는 기간을 고정시킵니다. 같은 핸들 아래의 모든 화면은 이미 이 변경을 따랐습니다.

**payload** `object`

**properties**

**period** `string` *required*

`"today"`, `"yesterday"`, `"last_7_days"`, `"last_14_days"`, `"last_30_days"`, `"last_90_days"`, `"all_time"`, `"custom"` 중 하나입니다.

**from** `string` *required*

**to** `string` *required*

### `onLoaderStart`

로딩 스켈레톤이 처음 그려진 후, `onReady` 전에 실행됩니다.

### `onReady`

엘리먼트가 처음으로 완전히 그려진 후 실행됩니다.

### `onError`

엘리먼트가 로드에 실패하거나 충돌할 때 실행됩니다. 대체 화면은 계속 표시됩니다. 프로그래밍 방식 처리에는 `code`를 사용하세요. `sourceKey`는 실패한 호스트 상태 소스를 식별합니다.

**e** `object`

**properties**

**message** `string` *required*

**code** `string`

**sourceKey** `string`

## 메서드

`create`가 반환한 핸들에서 또는 React `ref`를 통해 호출하세요.

### `mount`

엘리먼트를 `target`에 마운트하고 로딩을 시작합니다. React 컴포넌트는 스스로 마운트됩니다.

**매개변수**

**target** `string | HTMLElement` *required*

### `destroy`

엘리먼트를 제거하고 프레임과 구독을 해제합니다. 여러 번 호출해도 됩니다. React는 엘리먼트를 자동으로 제거합니다.

### `update`

마운트된 엘리먼트에 새 props를 병합합니다. React에서는 대신 컴포넌트 props를 변경하세요.

**매개변수**

**options** `Partial\<ChartElementProps\>` *required*

## 스타일링

이 엘리먼트는 스타일링용 클래스 이름을 노출하지 않습니다. 스타일을 바꾸려면 `appearance`(테마, 강조 색상, 변수)를 사용하세요.


## Related topics

- [보고서](https://docs.whop.com/ko/elements/latest/ads/reporting.md)
- [BalanceElement](https://docs.whop.com/ko/elements/latest/wallet/balances-balance.md)
- [BrandingElement](https://docs.whop.com/ko/elements/latest/payments/branding.md)
