File size: 1,726 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/**
 * Defines the blank space between the chart and the plot area.
 * This blank space is occupied by supporting elements like axes, legends, and brushes.
 * This also includes any margins that might be applied to the chart.
 */
export type ChartOffset = {
  /**
   * Distance from the top edge of the chart to the top edge of the plot area.
   */
  readonly top: number;
  /**
   * Distance from the bottom edge of the chart to the bottom edge of the plot area.
   * Note that this is not a coordinate, this is a distance.
   * Meaning, `offset.bottom` could be 0 in a perfectly fine big chart.
   */
  readonly bottom: number;
  /**
   * Distance from the left edge of the chart to the left edge of the plot area.
   */
  readonly left: number;
  /**
   * Distance from the right edge of the chart to the right edge of the plot area.
   * Note that this is not a coordinate, this is a distance.
   * Meaning, `offset.right` could be 0 in a perfectly fine big chart.
   */
  readonly right: number;
};

/**
 * Plot area is the area where the actual chart data is rendered.
 * This means: bars, lines, scatter points, etc.
 */
export type PlotArea = {
  /**
   * The width of the plot area.
   * This will be the same as `chartWidth - offset.left - offset.right`
   */
  readonly width: number;
  /**
   * The height of the plot area.
   * This will be the same as `chartHeight - offset.top - offset.bottom`
   */
  readonly height: number;
  /**
   * The x coordinate of the top-left corner of the plot area.
   * This will be the same as `offset.left`
   */
  readonly x: number;
  /**
   * The y coordinate of the top-left corner of the plot area.
   * This will be the same as `offset.top`
   */
  readonly y: number;
};