# Marker Gauge Examples

**Component Reference:** Marker Gauge or @splunk/visualizations/MarkerGauge

## Basic Marker Gauge

- **Key:** Basic

```jsx
import React from 'react';
import MarkerGauge from '@splunk/visualizations/MarkerGauge';

export default () => (
    <MarkerGauge
        options={{}}
        dataSources={{
            primary: {
                requestParams: { offset: 0, count: 20 },
                data: {
                    fields: [
                        {
                            name: 'count',
                        },
                    ],
                    columns: [['20']],
                },
                meta: { totalCount: 100 },
            },
        }}
    />
);
```

## Background Color - Light Blue

- **Key:** Background Color

```jsx
import React from 'react';
import MarkerGauge from '@splunk/visualizations/MarkerGauge';

export default () => (
    <MarkerGauge
        options={{ backgroundColor: '#ADD8E6' }}
        dataSources={{
            primary: {
                requestParams: { offset: 0, count: 20 },
                data: {
                    fields: [
                        {
                            name: 'count',
                        },
                    ],
                    columns: [['20']],
                },
                meta: { totalCount: 100 },
            },
        }}
    />
);
```

## Gauge Ranges: negative 10 to 40 - Cyan

- **Key:** Ranges Single Step

```jsx
import React from 'react';
import MarkerGauge from '@splunk/visualizations/MarkerGauge';

export default () => (
    <MarkerGauge
        options={{
            gaugeRanges: [
                {
                    from: -10,
                    to: 40,
                    value: '#00FFFF',
                },
            ],
        }}
        dataSources={{
            primary: {
                requestParams: { offset: 0, count: 20 },
                data: {
                    fields: [
                        {
                            name: 'count',
                        },
                    ],
                    columns: [['20']],
                },
                meta: { totalCount: 100 },
            },
        }}
    />
);
```

## Gauge Ranges: 0 to 10 - Cyan, 10 to 20 - Orange, 20 to 30 - Green, 30 to 40 - Light Blue

- **Key:** Ranges Multiple Step

```jsx
import React from 'react';
import MarkerGauge from '@splunk/visualizations/MarkerGauge';

export default () => (
    <MarkerGauge
        options={{
            gaugeRanges: [
                {
                    from: 0,
                    to: 10,
                    value: '#00FFFF',
                },
                {
                    from: 10,
                    to: 20,
                    value: '#FFA500',
                },
                {
                    from: 20,
                    to: 30,
                    value: '#008000',
                },
                {
                    from: 30,
                    to: 40,
                    value: '#ADD8E6',
                },
            ],
        }}
        dataSources={{
            primary: {
                requestParams: { offset: 0, count: 20 },
                data: {
                    fields: [
                        {
                            name: 'count',
                        },
                    ],
                    columns: [['20']],
                },
                meta: { totalCount: 100 },
            },
        }}
    />
);
```

## Label Display - Percentage

- **Key:** Percentage Range

```jsx
import React from 'react';
import MarkerGauge from '@splunk/visualizations/MarkerGauge';

export default () => (
    <MarkerGauge
        options={{ labelDisplay: 'percentage' }}
        dataSources={{
            primary: {
                requestParams: { offset: 0, count: 20 },
                data: {
                    fields: [
                        {
                            name: 'count',
                        },
                    ],
                    columns: [['20']],
                },
                meta: { totalCount: 100 },
            },
        }}
    />
);
```

## Label Display - Off

- **Key:** No Labels

```jsx
import React from 'react';
import MarkerGauge from '@splunk/visualizations/MarkerGauge';

export default () => (
    <MarkerGauge
        options={{ labelDisplay: 'off' }}
        dataSources={{
            primary: {
                requestParams: { offset: 0, count: 20 },
                data: {
                    fields: [
                        {
                            name: 'count',
                        },
                    ],
                    columns: [['20']],
                },
                meta: { totalCount: 100 },
            },
        }}
    />
);
```

## Major Tick Interval - 10

- **Key:** Major Unit

```jsx
import React from 'react';
import MarkerGauge from '@splunk/visualizations/MarkerGauge';

export default () => (
    <MarkerGauge
        options={{ majorTickInterval: 10 }}
        dataSources={{
            primary: {
                requestParams: { offset: 0, count: 20 },
                data: {
                    fields: [
                        {
                            name: 'count',
                        },
                    ],
                    columns: [['20']],
                },
                meta: { totalCount: 100 },
            },
        }}
    />
);
```

## Orientation - Horizontal

- **Key:** Horizontal

```jsx
import React from 'react';
import MarkerGauge from '@splunk/visualizations/MarkerGauge';

export default () => (
    <MarkerGauge
        options={{
            orientation: 'horizontal',
        }}
        dataSources={{
            primary: {
                requestParams: { offset: 0, count: 20 },
                data: {
                    fields: [
                        {
                            name: 'count',
                        },
                    ],
                    columns: [['20']],
                },
                meta: { totalCount: 100 },
            },
        }}
    />
);
```

## Value Display - Percentage

- **Key:** Percentage Value

```jsx
import React from 'react';
import MarkerGauge from '@splunk/visualizations/MarkerGauge';

export default () => (
    <MarkerGauge
        options={{ valueDisplay: 'percentage' }}
        dataSources={{
            primary: {
                requestParams: { offset: 0, count: 20 },
                data: {
                    fields: [
                        {
                            name: 'count',
                        },
                    ],
                    columns: [['20']],
                },
                meta: { totalCount: 100 },
            },
        }}
    />
);
```

## Value Display - Off

- **Key:** No Value

```jsx
import React from 'react';
import MarkerGauge from '@splunk/visualizations/MarkerGauge';

export default () => (
    <MarkerGauge
        options={{ valueDisplay: 'off' }}
        dataSources={{
            primary: {
                requestParams: { offset: 0, count: 20 },
                data: {
                    fields: [
                        {
                            name: 'count',
                        },
                    ],
                    columns: [['20']],
                },
                meta: { totalCount: 100 },
            },
        }}
    />
);
```

## Trellis

- **Key:** Trellis

```jsx
import React from 'react';
import { FeatureFlagContextProvider } from '@splunk/visualization-context/FeatureFlagContext';
import MarkerGauge from '@splunk/visualizations/MarkerGauge';

export default () => (
    <FeatureFlagContextProvider value={{ visualizations_enableTrellis: true }}>
        <MarkerGauge
            options={{
                splitByLayout: 'trellis',
                trellisSplitBy: 'component',
            }}
            dataSources={{
                primary: {
                    data: {
                        fields: [
                            {
                                name: 'component',
                                groupby_rank: '0',
                            },
                            {
                                name: 'count',
                            },
                        ],
                        columns: [
                            ['Database', 'API', 'Cache', 'Queue', 'Frontend', 'Backend'],
                            ['78', '65', '82', '91', '73', '88'],
                        ],
                    },
                    meta: {},
                },
            }}
        />
    </FeatureFlagContextProvider>
);
```
