# Wind Direction Easy Chart

**URL:** <https://forum.inductiveautomation.com/t/wind-direction-easy-chart/58556>\
**Category:** Ignition\
**Tags:** ignition81, vision\
**Created:** [April 18, 2022, 4:29pm UTC](https://forum.inductiveautomation.com/t/wind-direction-easy-chart/58556 "2022-04-18T16:29:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![markusx1094](https://avatars.discourse-cdn.com/v4/letter/m/77aa72/32.png) [@markusx1094](https://forum.inductiveautomation.com/u/markusx1094)\
**Post date:** [April 18, 2022, 4:29pm UTC](https://forum.inductiveautomation.com/t/wind-direction-easy-chart/58556/1 "2022-04-18T16:29:06Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/9/4968a24c8fba417bee0f401bb473d1d025d737a7.png)

So I am trying to get my easy chart to implement different wind directions based on the historical wind direction value. This would be on a historical wind speed avg calculated pen. I looked into the Jfreechart documentation a bit but couldn’t figure out a way to do this. The ultimate goal would be to have something similar to what the picture shows. I know I can do a workaround by using `getXTraceLabel` and writing the value to a custom property and having a component tied to that value but I would like to do it dynamically on the graph if feasible.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [April 18, 2022, 4:36pm UTC](https://forum.inductiveautomation.com/t/wind-direction-easy-chart/58556/2 "2022-04-18T16:36:14Z")

</div>

Well, as a starting point, you’re going to need to generate a custom subclass or instance of [`XYLineAndShapeRenderer`](https://www.jfree.org/jfreechart/api/javadoc/org/jfree/chart/renderer/xy/XYLineAndShapeRenderer.html) and assign it your your series/plot.  
Rendering a different instance of the shape for each point seems to not be an _intended_ feature of JFreeChart, but does seem possible by overriding the appropriate methods.

Getting directional information into the chart might be somewhat complex; I assume that’s a second piece of information correlated to time, but JFreeChart will try to have that render as another axis.

---

<div class="post-metadata">

**Author:** ![markusx1094](https://avatars.discourse-cdn.com/v4/letter/m/77aa72/32.png) [@markusx1094](https://forum.inductiveautomation.com/u/markusx1094)\
**Post date:** [April 18, 2022, 4:53pm UTC](https://forum.inductiveautomation.com/t/wind-direction-easy-chart/58556/3 "2022-04-18T16:53:58Z")

</div>

Yea the other historical data is just the degree that the wind is blowing with 0 being north and 180 being south. It might work easier if I use less granular data, like 1-12 for the directional. I’ll look into it and see what I can figure out.

---

<div class="post-metadata">

**Author:** ![jpark](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@jpark](https://forum.inductiveautomation.com/u/jpark)\
**Post date:** [April 18, 2022, 7:54pm UTC](https://forum.inductiveautomation.com/t/wind-direction-easy-chart/58556/4 "2022-04-18T19:54:09Z")

</div>

You can use a shape object and rotate.

`ShapeUtilities.rotateShape(myShape, angleRad, 0,0)`

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/b/7b33667be70b2e34ce32bfe442bb3e9ccb4f5198.png)

---

<div class="post-metadata">

**Author:** ![markusx1094](https://avatars.discourse-cdn.com/v4/letter/m/77aa72/32.png) [@markusx1094](https://forum.inductiveautomation.com/u/markusx1094)\
**Post date:** [May 5, 2022, 3:27pm UTC](https://forum.inductiveautomation.com/t/wind-direction-easy-chart/58556/5 "2022-05-05T15:27:09Z")

</div>

Hey so I did some research into it, plus got sidetracked with some other projects, and was able to get an instance of the pen dataset using `pen = chart.getPlot().getDataset(0)` which gave me `com.inductiveautomation.factorypmi.application.components.chart.easychart.PenDataset@3952c969 `.  
I also used `pen = chart.getPlot().getDataset(0).getPens()` and got `[PenData(pen=Tag[Wind Direction],dataset=null)]`.  
Are either of these the correct information to do what I am trying to do and if so, how do I access the individual data points throughout as well as use those data points to change the direction of the shape.  
On the `XYLineAndShapeRenderer` the `drawItem()` seems to be the most promising but I’m not sure how to get all of the required arguments to override it.  
On top of that I would need to draw an instance of my own custom shape on there as the current shapes aren’t pointed in a specific direction.
