> For the complete documentation index, see [llms.txt](https://docs.bogged.finance/bogged-finance/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.bogged.finance/bogged-finance/token-teams/bogcharts/bogcharts-for-token-teams.md).

# BogCharts for Token Teams

If you have not yet done so, you can create a chart embed [**here**](https://teams.bogged.finance/chart).\
\
There are two types of chart embeds: [**iframe**](#iframe) and [**Web Component**](#web-component)

## iframe

Iframe code can be placed anywhere in your HTML code with no additional scripts.\
You can style the iframe with CSS just like any other HTML element.\
\
**Example:**

```html
<iframe
  src="https://teams.bogged.finance/embeds/chart?address=0xB09FE1613fE03E7361319d2a43eDc17422f36B09&chain=bsc&charttype=candles&theme=dark&defaultinterval=15m&showchartbutton=true"
  frameborder="0"
  height="400px"
  width="800px"
></iframe>
```

## Web Component

A Web Component is a new web technology to create reusable custom elements with their functionality encapsulated away from the rest of your code.\
\
For the Chart Web Component, you can modify any property on the element to have it update in real-time. You can also listen to the **onUpdate** event to get price information as the chart updates.

#### **Exposed Price Information**

```typescript
{
    "baseSymbol": string,
    "baseAddress": string,
    "baseDecimals": number,
    "basePriceUSD": number,
    "baseCircSupply": number,
    "baseTotalSupply": number,
    "baseMarketcap": number,
    "baseMarketcapFD": number,
    "quoteSymbol": string,
    "quoteAddress": string,
    "quoteDecimals": number,
    "quotePriceUSD": number,
    "tokensPerQuote": number,
    "singleLPValueUSD": number,
    "totalLiquidityUSD": number,
    "pairAddress": string,
    "pairFactory": string
}
```

### &#x20;Examples

#### **Dynamically Changing Chart Type**

```html
<body>
<!--   Example of a button that a user can click to change the type of the chart dynamically -->
 <button class="theme-btn" style="margin-bottom: 1rem;">Change Chart Type</button>
  
  <div style="max-width: 1000px; height: 600px">
    <chart-embed
      chain="bsc"
      address="0xB09FE1613fE03E7361319d2a43eDc17422f36B09"
      charttype="candles"
      theme="dark"
    ></chart-embed>
  </div>

  
    <script async type="module">
      //load script and register chart
      import { register } from "https://public.bog-general-api.com/static/chart/main.js";

      register("chart-embed");
      
      //query HTML elements
      const button = document.querySelector(".theme-btn")
      const embed = document.querySelector("chart-embed")
      
      //setup listener to change chart props
      button.onclick = ()=>{
        const type = embed.getAttribute("charttype");
        if(type === 'candles'){
          embed.setAttribute("charttype","line")
        }else{
          embed.setAttribute("charttype","candles")
        }
      }
    </script>
  </body>
```

{% embed url="<https://codepen.io/brettshepherd/pen/KKZbJgZ?editors=1000>" %}
**Changing Chart Type Example**
{% endembed %}

#### **Listening To Chart Update**

```html
<body>
<!-- Chart Container-->
  <div class="chart-container" style="max-width: 1000px; height: 600px">
    <chart-embed
      chain="bsc"
      address="0xB09FE1613fE03E7361319d2a43eDc17422f36B09"
      charttype="candles"
      theme="dark"
    ></chart-embed>
  </div>

<!-- Info Panel -->
  <div class="info-panel"></div>
  
  <script async type="module">
      //load script and register chart
      import { register } from "https://public.bog-general-api.com/static/chart/main.js";

      register("chart-embed");
      
      const infoPanel = document.querySelector(".info-panel")
      const embed = document.querySelector("chart-embed")
      
      embed.addEventListener("onUpdate",(e)=>{
        //get update info from the event
       const updateInfo = e.detail[0];
        
        //combine object into string of html
        const html =  Object.entries(updateInfo).reduce( (acc,[key,value]) => 
           acc + `<div><span>${key}</span>: ${value}</div>`
        ,"")
        //set to info panel
        infoPanel.innerHTML = html
      })
    </script>
  </body>
```

{% embed url="<https://codepen.io/brettshepherd/pen/rNJNQPm>" %}
Accessing Chart Update Example
{% endembed %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.bogged.finance/bogged-finance/token-teams/bogcharts/bogcharts-for-token-teams.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
