Improve OHLCChart AnnotationLine and AnnotationText

Open
#768 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 4 days

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
java

Research direction

Start by locating the OHLCChart, AnnotationLine, and AnnotationText APIs, then compare their behavior with the existing LineChart min/max methods. The requested scope includes OHLCChart extrema accessors, percentage-based chart dimensions, and positioning AnnotationText near an AnnotationLine; completion criteria would need to be clarified and tested for each part.

Written by the indexing model from the issue text.

Description

Improvement

I was trying to get the min and max values from my list and display those values as an AnnotationLine for my OHLCChart. Especially useful when plotting Fibonacci Retracements. However, I found out that Line Charts have getXMax(), getXMin(), getYMax(), getYMin() and not OHLCCharts even though OHLCCharts display the highs and lows of each candlestick. Intuitively, it would make sense that OHLCCharts can get a data's highest and lowest X and Y values but unfortunately it is not the case at the moment.

Additionally, chart.getHeight() and chart.getWidth() could get a double parameter where it gets a percentage of the chart height and width. Example: AnnotationLine lineY = new AnnotationLine(chart.getHeight(0.33), false, true); where 0.33 is 33% of the chart height so that the AnnotationLine can be placed at a position of 1/3 the chart height.

I also noticed that there is no method call that enables AnnotationText to be set at or near AnnotationLine. Instead a programmer would have to manually set the position of AnnotationText near a AnnotationLine if he or she does not use getXMax(), getXMin(), getYMax(), or getYMin(). Maybe a method call such as AnnotationText lineYText = new AnnotationText("FirstY", 0.0, AnnotationTextAlignment.AtAnnotationLineY, false); could help.

Dominant language
Java
Stars
1.6k
Forks
400
Avg merge
3d 9h
Merged PRs (30d)
7

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from knowm/XChart

All issues in knowm/XChart

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.