# DSL Overview Examples

## Example 1

```jsx
<SampleViz
    context={{
        foo: 2,
        bar: 3,
    }}
    options={{
        foo: 1,
        // the DSL will first look at the local scope before searching through context.foo, datasources.foo, and themes.foo
        // in this case, color will be resolved as 1
        color: '> foo',
        // since there is no local match, the DSL will look through the global scopes to find a corresponding identifier
        // in this case, value will be resolved as 3
        value: '> bar',
    }}
/>
```

## Example 2

```jsx
import SingleValue from '@splunk/visualizations/SingleValue';

export default () => (
    <SingleValue
        context={{
            trendColorThresholds: [
                {
                    from: 1321,
                    value: '#00FFFF',
                },
                {
                    to: 1321,
                    value: '#FF00FF',
                },
            ],
        }}
        options={{
            sparklineValues: '> primary | seriesByIndex(0)',
            trendValue: '> sparklineValues | delta(-2)',
            trendColor: '> trendValue | rangeValue(trendColorThresholds)',
        }}
        dataSources={{
            primary: {
                // the JSON input for a DataFrame has the structure of { data: { columns: [...], fields: [...], meta: {...} }
                data: {
                    columns: [
                        ['1', '62', '103', '308', '587', '876', '930', '1320'],
                        [
                            '2018-08-19T00:00:00.000+00:00',
                            '2018-08-20T00:00:00.000+00:00',
                            '2018-08-21T00:00:00.000+00:00',
                            '2018-08-22T00:00:00.000+00:00',
                            '2018-08-23T00:00:00.000+00:00',
                            '2018-08-24T00:00:00.000+00:00',
                            '2018-08-25T00:00:00.000+00:00',
                            '2018-08-26T00:00:00.000+00:00',
                        ],
                    ],
                    fields: [
                        {
                            name: 'foo',
                        },
                        {
                            name: 'bar',
                        },
                    ],
                },
                meta: {},
            },
        }}
    />
);
```
