# Apex chart in Perspective component

**URL:** <https://forum.inductiveautomation.com/t/apex-chart-in-perspective-component/100081>\
**Category:** Module Development\
**Tags:** ignition81, perspective\
**Created:** [December 20, 2024, 5:03am UTC](https://forum.inductiveautomation.com/t/apex-chart-in-perspective-component/100081 "2024-12-20T05:03:15Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Grace\_Gan](https://avatars.discourse-cdn.com/v4/letter/g/e5b9ba/32.png) [@Grace\_Gan](https://forum.inductiveautomation.com/u/Grace_Gan)\
**Post date:** [December 20, 2024, 5:03am UTC](https://forum.inductiveautomation.com/t/apex-chart-in-perspective-component/100081/1 "2024-12-20T05:03:15Z")

</div>

I'm building a custom perspective component using apex chart. What do I need to include the apexchart bundle in the module?

I got the perspective component working on my local ignition instance (running on docker) but when I install the module in another ignition instance (prod instance), the component gives the following error  
`TypeError: t.put is not a function`  
when try to call chart.render().

What could've caused this error

---

<div class="post-metadata">

**Author:** ![louagejasper](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/louagejasper/32/86311_2.png) [@louagejasper](https://forum.inductiveautomation.com/u/louagejasper)\
**Post date:** [December 20, 2024, 10:30am UTC](https://forum.inductiveautomation.com/t/apex-chart-in-perspective-component/100081/2 "2024-12-20T10:30:19Z")

</div>

What are you trying to build? You know there is an Perspective ApexChart component already, right? Or are you trying to expand on that module?

---

<div class="post-metadata">

**Author:** ![Grace\_Gan](https://avatars.discourse-cdn.com/v4/letter/g/e5b9ba/32.png) [@Grace\_Gan](https://forum.inductiveautomation.com/u/Grace_Gan)\
**Post date:** [January 5, 2025, 7:07pm UTC](https://forum.inductiveautomation.com/t/apex-chart-in-perspective-component/100081/3 "2025-01-05T19:07:52Z")

</div>

I'm trying to build a custom perspective component that includes an ApexChart, it's a pretty customized component as it handles data querying within the component so different to the exisitng Perspective ApexChart component.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [January 5, 2025, 8:13pm UTC](https://forum.inductiveautomation.com/t/apex-chart-in-perspective-component/100081/4 "2025-01-05T20:13:50Z")

</div>

> [@Grace\_Gan](#):
>
> as it handles data querying within the component

Ewww! Sounds like the same foolishness you've been advised against before (different components?):

> [@Perspective component get dropdown props from gateway](https://forum.inductiveautomation.com/t/perspective-component-get-dropdown-props-from-gateway/99606/4):
>
> Seems like an anti-pattern. Components are best when they’re flexible, and making a component do its own queries is at odds with the goals of Ignition. Is there a reason you don’t want to provide your options through a binding?

> [@Perspective Component](https://forum.inductiveautomation.com/t/perspective-component/98768/6):
>
> Ignition's query bindings are extraordinarily flexible. If you really want users to not worry about the behavior of the query inside your component, do not put the query inside your component. You are re-inventing the wheel. You are unlikely to do this as well as IA already did, with query bindings. Really. Don't have your component run its own queries. IA has some components that run their own queries. They are frustrating to use and utterly inflexible. Don't follow that example.

You **really** shouldn't be doing this.

---

<div class="post-metadata">

**Author:** ![Grace\_Gan](https://avatars.discourse-cdn.com/v4/letter/g/e5b9ba/32.png) [@Grace\_Gan](https://forum.inductiveautomation.com/u/Grace_Gan)\
**Post date:** [January 5, 2025, 8:27pm UTC](https://forum.inductiveautomation.com/t/apex-chart-in-perspective-component/100081/5 "2025-01-05T20:27:41Z")

</div>

I am aware of that but it does make sense in my use case for it to be a not flexible component

---

<div class="post-metadata">

**Author:** ![bmusson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmusson/32/87530_2.png) [@bmusson](https://forum.inductiveautomation.com/u/bmusson)\
**Post date:** [January 5, 2025, 8:53pm UTC](https://forum.inductiveautomation.com/t/apex-chart-in-perspective-component/100081/6 "2025-01-05T20:53:09Z")

</div>

Maybe a silly question, but why are you even building Perspective components?

If you don’t care about Ignition’s binding/data model I’d think it’d be easier to use iFrames.

---

<div class="post-metadata">

**Author:** ![Grace\_Gan](https://avatars.discourse-cdn.com/v4/letter/g/e5b9ba/32.png) [@Grace\_Gan](https://forum.inductiveautomation.com/u/Grace_Gan)\
**Post date:** [January 5, 2025, 9:14pm UTC](https://forum.inductiveautomation.com/t/apex-chart-in-perspective-component/100081/7 "2025-01-05T21:14:24Z")

</div>

I'm building a perspective component so that once the module is installed on the gateway, it is possible to drag a component into a perspective views and bind it with some simple input properties (e.g. start and end time). The component will then handle the querying of the related data (from a connected database) and display them in the charts.

It's a kind of component that is created multiple times in various projects and I want to abstract away most the data querying to reduce the time and effort required to set up the view. Since the data querying logic is same, it'll be nicer to have it abstracted away and handled by the component. Ideally, the user just need to drag the component in, bind the properties and the chart will display the relevant data.

I'm not so familiar with iFrames in ignition and how to set them up...they could be a potential solution to if you don't mind explaining how it could work for me? An example could be helpful.

Putting this aside, my initial question on this post was regarding the error with rendering the chart. It surprisingly works on my local ignition designer instance that is running on docker but not on the prod ignition designer instance. This is the error that I am getting `TypeError: t.put is not a function` when calling `chart.render()`

I am suspecting that this is due to the ApexChart bundle isn't installed properly with the module installation? But have no idea how to fix, any help will be appreciated.

---

<div class="post-metadata">

**Author:** ![Grace\_Gan](https://avatars.discourse-cdn.com/v4/letter/g/e5b9ba/32.png) [@Grace\_Gan](https://forum.inductiveautomation.com/u/Grace_Gan)\
**Post date:** [January 5, 2025, 11:27pm UTC](https://forum.inductiveautomation.com/t/apex-chart-in-perspective-component/100081/8 "2025-01-05T23:27:33Z")

</div>

I did some exploring and found out that it's because I have the  
Apex Chart Module installed on my ignition gateway ([GitHub - Kyvis-Labs/ignition-apexcharts-module: The module provides Perspective ApexCharts components](https://github.com/Kyvis-Labs/ignition-apexcharts-module)), which uses a different version of apexcharts, after changing it to the same version, my component now works. I do wonder if there is any better ways to include the apexcharts bundle so that it'll work despite the different versions used in two modules? Because I want to avoid having to update my module apexcharts versions whenever KyvisLabs update theirs.

Cheers

---

<div class="post-metadata">

**Author:** ![bmusson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmusson/32/87530_2.png) [@bmusson](https://forum.inductiveautomation.com/u/bmusson)\
**Post date:** [January 6, 2025, 12:28am UTC](https://forum.inductiveautomation.com/t/apex-chart-in-perspective-component/100081/9 "2025-01-06T00:28:04Z")

</div>

> [@Grace\_Gan](#):
>
> It's a kind of component that is created multiple times in various projects and I want to abstract away most the data querying to reduce the time and effort required to set up the view.

Is there a reason you can’t use embedded views?

> **[Perspective - Embedded View | Ignition User Manual](https://www.docs.inductiveautomation.com/docs/8.1/appendix/components/perspective-components/perspective-embedding-palette/perspective-embedded-view)**
>
> The Embedded View component allows you to include an entire view inside another.

I’m not trying to be unhelpful, but what you’re doing seems wildly over complicated. 99.999…% of people using Ignition solve this problem by creating reusable views that take parameters.

> [@Grace\_Gan](#):
>
> I'm not so familiar with iFrames in ignition and how to set them up...

Search the forum, I think there’s some examples floating around. Basically you set up a separate web server and use Perspective to load it in an iFrame. Beyond my capacity for free forum help 🤷‍♂️

> [@Grace\_Gan](#):
>
> I do wonder if there is any better ways to include the apexcharts bundle so that it'll work despite the different versions used in two modules? Because I want to avoid having to update my module apexcharts versions whenever KyvisLabs update theirs.

I think this is configurable in your bundler (Rollup, Webpack, etc.). You’ll want to avoid a namespace collision with the ApexCharts version the KyvisLabs module supplies.
