Skip to content

Commit 2bf5d20

Browse files
committed
AG-15641 - Spruce up gallery examples.
1 parent 14e542c commit 2bf5d20

File tree

126 files changed

+5709
-3147
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+5709
-3147
lines changed

packages/ag-charts-website/src/content/docs/key-features/_examples/map-kitchen-sink/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ const options: AgChartOptions = {
7575
.map((t: any) => {
7676
return { name: t.properties.city };
7777
})
78-
.filter(({ name }: any) => name != null),
78+
.filter(({ name }: { name: string }) => name != null),
7979
idKey: 'name',
8080
title: 'Capital City',
8181
topologyIdKey: 'city',

packages/ag-charts-website/src/content/gallery/_examples/100--stacked-area/data.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
// Source: https://www.gov.uk/government/statistics/total-energy-section-1-energy-trends
2-
export function getData(): any[] {
2+
3+
export interface EnergyData {
4+
date: Date;
5+
coal: number;
6+
petroleum: number;
7+
naturalGas: number;
8+
bioenergyWaste: number;
9+
nuclear: number;
10+
windSolarHydro: number;
11+
imported: number;
12+
}
13+
14+
export function getData(): EnergyData[] {
315
return [
416
{
517
date: new Date(2020, 0, 1),

packages/ag-charts-website/src/content/gallery/_examples/100--stacked-area/main.ts

Lines changed: 55 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,36 @@
1-
import { AgChartOptions, AgCharts } from 'ag-charts-enterprise';
1+
import { AgCartesianChartOptions, AgCharts } from 'ag-charts-enterprise';
22

3-
import { getData } from './data';
3+
import { EnergyData, getData } from './data';
44

55
const interpolation = { type: 'smooth' } as const;
66

7-
const options: AgChartOptions = {
7+
const options: AgCartesianChartOptions = {
88
container: document.getElementById('myChart'),
99
data: getData(),
1010
title: {
1111
text: 'UK Energy Sources',
12-
fontSize: 20,
12+
spacing: 25,
1313
},
1414
footnote: {
1515
text: 'Source: Department for Business, Energy & Industrial Strategy',
16-
fontSize: 12,
1716
fontStyle: 'italic',
17+
spacing: 10,
18+
},
19+
theme: {
20+
overrides: {
21+
area: {
22+
series: {
23+
strokeWidth: 1.5,
24+
fillOpacity: 0.88,
25+
highlight: {
26+
highlightedItem: {
27+
fillOpacity: 0.95,
28+
strokeWidth: 2,
29+
},
30+
},
31+
},
32+
},
33+
},
1834
},
1935
series: [
2036
{
@@ -46,9 +62,6 @@ const options: AgChartOptions = {
4662
normalizedTo: 1,
4763
stacked: true,
4864
interpolation,
49-
fill: {
50-
type: 'pattern',
51-
},
5265
},
5366
{
5467
type: 'area',
@@ -88,15 +101,20 @@ const options: AgChartOptions = {
88101
normalizedTo: 1,
89102
stacked: true,
90103
interpolation,
91-
fill: {
92-
type: 'pattern',
93-
},
94104
},
95105
],
96106
axes: [
97107
{
98108
type: 'unit-time',
99109
position: 'bottom',
110+
crosshair: {
111+
enabled: true,
112+
strokeWidth: 1,
113+
lineDash: [3, 3],
114+
label: {
115+
enabled: true,
116+
},
117+
},
100118
},
101119
{
102120
type: 'number',
@@ -109,12 +127,36 @@ const options: AgChartOptions = {
109127
},
110128
title: {
111129
text: 'Percentage of Total Energy',
112-
fontSize: 14,
113130
},
114131
},
115132
],
116133
legend: {
117-
position: 'top',
134+
position: 'bottom',
135+
spacing: 25,
136+
item: {
137+
paddingX: 10,
138+
paddingY: 8,
139+
},
140+
},
141+
tooltip: {
142+
mode: 'shared',
143+
position: {
144+
placement: ['right', 'left', 'top', 'bottom'],
145+
},
146+
range: 'nearest',
147+
showArrow: false,
148+
},
149+
animation: {
150+
enabled: true,
151+
duration: 800,
152+
},
153+
seriesArea: {
154+
padding: {
155+
top: 20,
156+
right: 25,
157+
bottom: 15,
158+
left: 15,
159+
},
118160
},
119161
formatter: (params) => {
120162
const { value, type } = params;

packages/ag-charts-website/src/content/gallery/_examples/100--stacked-column/main.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ const options: AgChartOptions = {
1111
footnote: {
1212
text: 'Source: Department for Education',
1313
},
14+
tooltip: {
15+
mode: 'shared',
16+
},
1417
series: [
1518
{
1619
type: 'bar',
@@ -65,6 +68,9 @@ const options: AgChartOptions = {
6568
{
6669
type: 'category',
6770
position: 'bottom',
71+
bandHighlight: {
72+
enabled: true,
73+
},
6874
},
6975
{
7076
type: 'number',
@@ -74,6 +80,9 @@ const options: AgChartOptions = {
7480
},
7581
},
7682
],
83+
legend: {
84+
position: 'bottom',
85+
},
7786
};
7887

7988
AgCharts.create(options);

packages/ag-charts-website/src/content/gallery/_examples/area-with-labels/main.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,6 @@ const options: AgChartOptions<DataType> = {
2626
yKey: 'sales',
2727
yName: 'Sales',
2828
strokeWidth: 1,
29-
fill: {
30-
type: 'gradient',
31-
colorStops: [
32-
{ color: '#ffffff', stop: 0 },
33-
{ color: '#7da9e8', stop: 0.75 },
34-
{ color: '#2c6ed5', stop: 1 },
35-
],
36-
},
3729
label: {
3830
enabled: true,
3931
},
@@ -43,10 +35,16 @@ const options: AgChartOptions<DataType> = {
4335
{
4436
type: 'unit-time',
4537
position: 'bottom',
38+
gridLine: {
39+
style: [{ strokeWidth: 1, lineDash: [2, 2] }, { strokeWidth: 0 }],
40+
},
4641
},
4742
{
4843
type: 'number',
4944
position: 'left',
45+
gridLine: {
46+
style: [{ strokeWidth: 1, lineDash: [2, 2] }, { strokeWidth: 0 }],
47+
},
5048
},
5149
],
5250
formatter: {

packages/ag-charts-website/src/content/gallery/_examples/area-with-markers/main.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ const options: AgChartOptions = {
1111
subtitle: {
1212
text: 'Q4 Net New Subscription Revenue In Millions',
1313
},
14+
tooltip: {
15+
enabled: true,
16+
mode: 'shared',
17+
},
1418
theme: {
1519
overrides: {
1620
area: {
@@ -50,6 +54,9 @@ const options: AgChartOptions = {
5054
label: {
5155
rotation: -90,
5256
},
57+
bandHighlight: {
58+
enabled: true,
59+
},
5360
crossLines: [
5461
{
5562
type: 'range',
Lines changed: 98 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,102 @@
1-
// Source: https://www.gov.uk/government/statistics/total-energy-section-1-energy-trends
1+
// SaaS startup journey: From launch losses through growth to profitability
22
export function getData(): any[] {
33
return [
4-
{ quarter: 'Q1', coal: -666, manufacturedFuels: -14, primaryOil: -261, petroleum: -124, naturalGas: -1197 },
5-
{ quarter: 'Q2', coal: 208, manufacturedFuels: 71, primaryOil: 950, petroleum: -318, naturalGas: 906 },
6-
{ quarter: 'Q3', coal: 426, manufacturedFuels: 19, primaryOil: -845, petroleum: 166, naturalGas: 276 },
7-
{ quarter: 'Q4', coal: 158, manufacturedFuels: -29, primaryOil: -156, petroleum: -19, naturalGas: 672 },
4+
// Early startup phase - high costs, low revenue
5+
{
6+
quarter: ['2022', 'Q1'],
7+
productRevenue: 850,
8+
serviceRevenue: 200,
9+
operatingCosts: -4200,
10+
rdInvestment: -2800,
11+
},
12+
{
13+
quarter: ['2022', 'Q2'],
14+
productRevenue: 1400,
15+
serviceRevenue: 350,
16+
operatingCosts: -4800,
17+
rdInvestment: -3200,
18+
},
19+
20+
// Product-market fit discovery - rapid growth begins
21+
{
22+
quarter: ['2022', 'Q3'],
23+
productRevenue: 2800,
24+
serviceRevenue: 650,
25+
operatingCosts: -5200,
26+
rdInvestment: -3500,
27+
},
28+
{
29+
quarter: ['2022', 'Q4'],
30+
productRevenue: 4200,
31+
serviceRevenue: 950,
32+
operatingCosts: -5800,
33+
rdInvestment: -3800,
34+
},
35+
36+
// Scale-up phase - explosive growth, heavy investment
37+
{
38+
quarter: ['2023', 'Q1'],
39+
productRevenue: 6500,
40+
serviceRevenue: 1400,
41+
operatingCosts: -7200,
42+
rdInvestment: -4200,
43+
},
44+
{
45+
quarter: ['2023', 'Q2'],
46+
productRevenue: 9200,
47+
serviceRevenue: 2100,
48+
operatingCosts: -8500,
49+
rdInvestment: -4800,
50+
},
51+
52+
// Market downturn - costs cut, growth slows
53+
{
54+
quarter: ['2023', 'Q3'],
55+
productRevenue: 8800,
56+
serviceRevenue: 2300,
57+
operatingCosts: -6900,
58+
rdInvestment: -3200,
59+
},
60+
{
61+
quarter: ['2023', 'Q4'],
62+
productRevenue: 9500,
63+
serviceRevenue: 2800,
64+
operatingCosts: -6200,
65+
rdInvestment: -2800,
66+
},
67+
68+
// Recovery and optimization - approaching profitability
69+
{
70+
quarter: ['2024', 'Q1'],
71+
productRevenue: 11200,
72+
serviceRevenue: 3200,
73+
operatingCosts: -8200,
74+
rdInvestment: -3500,
75+
},
76+
{
77+
quarter: ['2024', 'Q2'],
78+
productRevenue: 13500,
79+
serviceRevenue: 3800,
80+
operatingCosts: -9100,
81+
rdInvestment: -4200,
82+
},
83+
84+
// Breakthrough quarter - first profitable quarter
85+
{
86+
quarter: ['2024', 'Q3'],
87+
productRevenue: 16200,
88+
serviceRevenue: 4500,
89+
operatingCosts: -11200,
90+
rdInvestment: -4800,
91+
},
92+
93+
// Sustained profitability - strong finish
94+
{
95+
quarter: ['2024', 'Q4'],
96+
productRevenue: 19500,
97+
serviceRevenue: 5200,
98+
operatingCosts: -13800,
99+
rdInvestment: -5500,
100+
},
8101
];
9102
}

0 commit comments

Comments
 (0)