# Musson Industrial’s Embr-Charts Module

**URL:** <https://forum.inductiveautomation.com/t/musson-industrial-s-embr-charts-module/91618>\
**Category:** 3rd Party Modules\
**Tags:** perspective\
**Created:** [June 10, 2024, 12:53pm UTC](https://forum.inductiveautomation.com/t/musson-industrial-s-embr-charts-module/91618 "2024-06-10T12:53:46Z")\
**Posts on this page:** 1\
**Showing post:** 87

<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:** [December 21, 2024, 10:31pm UTC](https://forum.inductiveautomation.com/t/musson-industrial-s-embr-charts-module/91618/87 "2024-12-21T22:31:31Z")

</div>

Here's an example of loading _extremely large_ datasets into the chart by bypassing the component props and directly updating the data of the chart instance.

I'm generating my data here, but it's not hard to imagine using a query instead.

```python
def runAction(self, event):
	from java.lang import Math

	component = self.parent.parent.getChild("Chartjs")
	chart = component.getJavaScriptProxy('chart')
	
	elements = self.view.custom.actions.elements
	chunkSize = self.view.custom.actions.chunkSize
	chunks = elements / chunkSize
	
	def setState(state):
		self.view.custom.actions.state = state
		
	addData = '''(data) => {
		const oldData = this.data.datasets[0].data
		const newData = oldData.concat(data)
		this.data.datasets[0].data = newData
	}'''
	
	updateChart = '''() => this.update('none')'''
		
	def getData(index, size):
		return [ {
			'x': i, 
			'y': 100 * Math.sin( i / 1000.0)
		} for i in range(index, index+size) ]
					
			
	for index in range(chunks):
		setState('Sending chunk %s/%s' % (index, chunks))
		data = getData(index*chunkSize, chunkSize)
		chart.runBlocking(addData, { 'data': data })
	
	chart.runBlocking(updateChart)
	setState('Finished.')

```

(The chunking code is crude, so what 🤷‍♂️)

---

_[View the full topic](https://forum.inductiveautomation.com/t/musson-industrial-s-embr-charts-module/91618)._
