> ## Documentation Index
> Fetch the complete documentation index at: https://doc.lucidworks.com/llms.txt
> Use this file to discover all available pages before exploring further.

# chart:export

[localhost link]: http://localhost:3000/docs/5/app-studio/reference/tags/lightning.directive.chartExport

[mintlify link]: https://doc.lucidworks.com/docs/5/app-studio/reference/tags/lightning.directive.chartExport

[old doc.lw link]: https://doc.lucidworks.com/app-studio/4.2/1101.md

> [card] Key questions to get you started
>
> Powered by Lucidworks Agent Studio

## Description

To give users the option to export a chart include the Chart Export tag
within the Chart Display tag. Adding the tag will enable exporting
without adding any attributes. This tag must be nested in the
[Chart Display tag](https://doc.lucidworks.com/docs/4/app-studio/reference/tags/lightning.directive.chartDisplay.md).

## Usage

as element:

```xml wrap  theme={"dark"}
<chart:export
       [file-name="{string}"]
       [url="{string}"]>
</chart:export>
```

### Directive info

* This directive creates new scope.

#### Parameters

| Param | Type | Details |
| - | - | - |
| file-name  *(optional)* | **string** | Custom name for the file when downloaded, if nothing is entered it will default to 'chart'. |
| url  *(optional)* | **string** | Url of the export server, if left blank it will use the providers export server. |

## Example

#### Source

```xml wrap  theme={"dark"}
<chart:display response="response" facet-name="test" type="column">
    <chart:export file-name="column"></chart:export>
</chart:display>
```

```js wrap  expandable  theme={"dark"}
angular.module('lightning')
.controller('ExampleController', ['$scope','$timeout','ResponseService', function($scope,$timeout,ResponseService) {
            $scope.response = {
                page: 2,
                query: {
                    rpp: 50
                },
                facets: {
                    test: {
                        filters: [
                            {

                                val: {
                                    dsp: 'dsp1',
                                    act: 1
                                },
                                count: 1,

                            },
                            {

                                val: {
                                    dsp: 'dsp2',
                                    act: 2
                                },
                                count: 2,
                            }

                        ]
                    },
                },
                results: [
                    {
                        result: {
                            fields: {
                                label: 'label1',
                                value: 1
                            }
                        },

                    },
                    {
                        result: {
                            fields: {
                                label: 'label2',
                                value: 2
                            }
                        },

                        hits: {
                            act: ['Hits', 264]
                        }
                    }]
            }

            ResponseService.setResponse('response',$scope.response);
        }]);
```

#### Result

![Result](https://mintcdn.com/lucidworks/_JCWsGwGCZxJia7w/assets/images/app-studio/as-examples/tags/chartExport.png?fit=max\&auto=format\&n=_JCWsGwGCZxJia7w\&q=85\&s=1170b8f5f9c9326a4c129c040e34e950)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.