Update Line Charts authored by Andrey Ruzhanskiy's avatar Andrey Ruzhanskiy
......@@ -15,7 +15,8 @@ There is not much to say about the axis itself, the *LineChartRasterizer* does n
## **Line rasterizing algorithm**
The *LineChartRasterizer* currently uses the **bresenham** algorithm to draw a line between two datapoints as nearly to the ideal line as possible. Because **bresenham** assumes an equal distant grid, there is a conversion to be done between the geometrical position (for example in milimetres) and the dot position, measured in braillecell/ dots. The current implementation looksup the nearest point, which is why there are sometime aritfact points.
Here the code:
` private void bresenham(final Double xStart, final Double yStart, final Double xEnd, final Double yEnd) {
```java
private void bresenham(final Double xStart, final Double yStart, final Double xEnd, final Double yEnd) {
int y0 = (int) (mCanvas.toDotRectangle(mCellLineArea).intWrapper().getHeight() - yStart);
int y1 = (int) (mCanvas.toDotRectangle(mCellLineArea).intWrapper().getHeight() - yEnd);
int x0 = (int) (xStart.doubleValue());
......@@ -41,7 +42,8 @@ Here the code:
y0 += sy;
}
}
}`
}
```
There is future work to be done in evaluating more line draw algorithms, for example "P. Stephenson, B. Litow: Running the line:Line drawing using runs and runs of runs". Sadly, this algorithm is closed source and was only made available after the project finished.
......
......