# Calculation chart

**URL:** <https://discourse.processing.org/t/calculation-chart/5848>\
**Category:** Electronics (Arduino, etc.)\
**Created:** [November 23, 2018, 8:20am UTC](https://discourse.processing.org/t/calculation-chart/5848 "2018-11-23T08:20:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dirk](https://avatars.discourse-cdn.com/v4/letter/d/87869e/32.png) [@Dirk](https://discourse.processing.org/u/Dirk)\
**Post date:** [November 23, 2018, 8:20am UTC](https://discourse.processing.org/t/calculation-chart/5848/1 "2018-11-23T08:20:26Z")

</div>

Hello experts,

I am reading out a sencor for light. The value of this I want to use in a chart.  
The chart width and height is 700 x 1200.  
The value of the Y-axis is from 0 to 1400  
The value of the X-axis is from 0 to 24 hours  
I am using the line() method to draw this.  
the screen of my laptop has a resolution of 1366 x 768.

Now i need to draw out the value of the sensor to my chart. But i can’t get it working!! i am trying this already for three days!

Please help me!

I have tried to use a ratio of pixels and the chart.  
and i now the line method starts in the upper left corner. How do I do this?

---

<div class="post-metadata">

**Author:** ![TfGuy44](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tfguy44/32/41_2.png) [@TfGuy44](https://discourse.processing.org/u/TfGuy44)\
**Post date:** [November 23, 2018, 8:46am UTC](https://discourse.processing.org/t/calculation-chart/5848/2 "2018-11-23T08:46:18Z")

</div>

Here, study this example so that you can learn how to position the sketch’s coordinate system so it matches the graph’s.

```auto
void setup(){
  size(800,800);
}

void draw(){
  background(0);
  translate(20,height-20);
  scale(1,-1);
  stroke(255);
  line(0,0,width-40,0);
  line(0,0,0,height-40);
  stroke(255,0,0);
  line(0,0,50,500);
  line(50,500,100,70);
  line(100,70,150,400);
}

```

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [November 24, 2018, 8:51pm UTC](https://discourse.processing.org/t/calculation-chart/5848/3 "2018-11-24T20:51:00Z")

</div>

For more on understanding the origins and orientation of drawing, you may also find these useful:

- Coordinate System and Shapes [https://processing.org/tutorials/drawing/](https://processing.org/tutorials/drawing/)
- 2D Transformations [https://processing.org/tutorials/transform2d/](https://processing.org/tutorials/transform2d/)

---

<div class="post-metadata">

**Author:** ![Dirk](https://avatars.discourse-cdn.com/v4/letter/d/87869e/32.png) [@Dirk](https://discourse.processing.org/u/Dirk)\
**Post date:** [November 25, 2018, 8:30am UTC](https://discourse.processing.org/t/calculation-chart/5848/4 "2018-11-25T08:30:17Z")

</div>

Thank you all! Especially for the suggestions. Finally I found a way to use a percentage-calculation. With this method it fits to every resolution.

Kind regards,

Dirk
