|
9 | 9 | lightningChart, |
10 | 10 | AxisTickStrategies, |
11 | 11 | OHLCSeriesTypes, |
12 | | - emptyLine |
| 12 | + emptyLine, |
| 13 | + Themes |
13 | 14 | } = lcjs |
14 | 15 |
|
15 | 16 | // Import data-generator from 'xydata'-library. |
@@ -38,41 +39,57 @@ const dataFrequency = 1 * 1000 |
38 | 39 |
|
39 | 40 | // Decide on an origin for DateTime axis. |
40 | 41 | const dateOrigin = new Date(2018, 0, 1) |
41 | | -const dateTimeTickStrategy = AxisTickStrategies.DateTime(dateOrigin) |
42 | | - |
43 | 42 | // Create charts and series for two different packing resolutions. |
44 | 43 | const lc = lightningChart() |
45 | 44 | const chartDefault = lc.ChartXY({ |
46 | | - containerId: 'div1', |
47 | | - defaultAxisXTickStrategy: dateTimeTickStrategy |
| 45 | + container: 'div1', |
| 46 | + // theme: Themes.dark |
48 | 47 | }) |
| 48 | +// Use DateTime TickStrategy with custom origin date. |
| 49 | +chartDefault |
| 50 | + .getDefaultAxisX() |
| 51 | + .setTickStrategy( |
| 52 | + AxisTickStrategies.DateTime, |
| 53 | + (tickStrategy) => tickStrategy.setDateOrigin(dateOrigin) |
| 54 | + ) |
| 55 | + |
| 56 | +chartDefault |
49 | 57 | .setTitle('Default packing resolution') |
50 | 58 | .setAutoCursor(cursor => { |
51 | 59 | cursor.disposeTickMarkerY() |
52 | 60 | cursor.setGridStrokeYStyle(emptyLine) |
53 | 61 | }) |
54 | | - // Preventing ResultTable from getting cut at the edge |
55 | | - .setPadding({ |
56 | | - right: 42 |
57 | | - }) |
| 62 | +// Preventing ResultTable from getting cut at the edge |
| 63 | +chartDefault.setPadding({ |
| 64 | + right: 42 |
| 65 | +}) |
58 | 66 |
|
59 | 67 | // show title 'USD on Y axis |
60 | 68 | chartDefault.getDefaultAxisY() |
61 | 69 | .setTitle('USD') |
62 | 70 |
|
63 | 71 | const chartLow = lc.ChartXY({ |
64 | | - containerId: 'div2', |
65 | | - defaultAxisXTickStrategy: dateTimeTickStrategy |
| 72 | + container: div2, |
| 73 | + // theme: Themes.dark |
66 | 74 | }) |
| 75 | +// Use DateTime TickStrategy with custom origin date. |
| 76 | +chartLow |
| 77 | + .getDefaultAxisX() |
| 78 | + .setTickStrategy( |
| 79 | + AxisTickStrategies.DateTime, |
| 80 | + (tickStrategy) => tickStrategy.setDateOrigin(dateOrigin) |
| 81 | + ) |
| 82 | + |
| 83 | +chartLow |
67 | 84 | .setTitle('Very small packing resolution') |
68 | 85 | .setAutoCursor(cursor => { |
69 | 86 | cursor.disposeTickMarkerY() |
70 | 87 | cursor.setGridStrokeYStyle(emptyLine) |
71 | 88 | }) |
72 | | - // Preventing ResultTable from getting cut at the edge |
73 | | - .setPadding({ |
74 | | - right: 42 |
75 | | - }) |
| 89 | +// Preventing ResultTable from getting cut at the edge |
| 90 | +chartLow.setPadding({ |
| 91 | + right: 42 |
| 92 | +}) |
76 | 93 |
|
77 | 94 | // show title 'USD on Y axis |
78 | 95 | chartLow.getDefaultAxisY() |
|
0 commit comments