Search results

Export and Print in Vue Range Navigator component

24 Sep 2021 / 2 minutes to read

Export

The rendered Range Selector can be exported to JPEG, PNG, SVG, or PDF format by using the export method in the Range Selector. This method contains the following parameters:

  • Type - To specify the export type. The component can be exported to JPEG, PNG, SVG, or PDF format.
  • File name - To specify the file name to export.
  • Orientation - To specify the orientation type. This is applicable only for PDF export type.
Source
Preview
app.vue
Copied to clipboard
<template>
<div id="app">
 <ejs-button id='export' @click.native='exportIcon'>Export</ejs-button>
    <ejs-rangenavigator ref="chart" :valueType='valueType' :value='value' :labelFormat='labelFormat'>
        <e-rangenavigator-series-collection>
            <e-rangenavigator-series :dataSource='data' type='Area' xName='x' yName='y' width=2>
            </e-rangenavigator-series>
        </e-rangenavigator-series-collection>
    </ejs-rangenavigator>
</div>
</template>
<script>
import Vue from "vue";
import { RangeNavigatorPlugin, AreaSeries, DateTime } from "@syncfusion/ej2-vue-charts";
import { ButtonPlugin } from "@syncfusion/ej2-vue-buttons";
import { bitCoinData } from "./default_data.js";

Vue.use(RangeNavigatorPlugin);
Vue.use(ButtonPlugin);

export default {
  data() {
return {
 valueType: 'DateTime',
 value: [new Date('2017-09-01'), new Date('2018-02-01')],
 labelFormat: 'MMM-yy',
 data: bitCoinData
};
  },
  provide: {
rangeNavigator: [DateTime, AreaSeries]
  },
  methods: {
exportIcon: function() {
    this.$refs.chart.export('PNG', 'export');
}
  }
};
</script>

Print

The rendered Range Selector can be printed directly from the browser by calling the public method print.

Source
Preview
app.vue
Copied to clipboard
<template>
<div id="app">
  <ejs-button id='print' @click.native='print'>Print</ejs-button>
    <ejs-rangenavigator ref="chart" :valueType='valueType' :value='value' :labelFormat='labelFormat'>
        <e-rangenavigator-series-collection>
            <e-rangenavigator-series :dataSource='data' type='Area' xName='x' yName='y' width=2>
            </e-rangenavigator-series>
        </e-rangenavigator-series-collection>
    </ejs-rangenavigator>
</div>
</template>
<script>
import Vue from "vue";
import { RangeNavigatorPlugin, AreaSeries, DateTime } from "@syncfusion/ej2-vue-charts";
import { ButtonPlugin } from "@syncfusion/ej2-vue-buttons";
import { bitCoinData } from "./default_data.js";

Vue.use(RangeNavigatorPlugin);
Vue.use(ButtonPlugin);

export default {
  data() {
return {
 valueType: 'DateTime',
 value: [new Date('2017-09-01'), new Date('2018-02-01')],
 labelFormat: 'MMM-yy',
 data: bitCoinData
};
  },
  provide: {
rangeNavigator: [DateTime, AreaSeries]
  },
  methods: {
print: function() {
    this.$refs.chart.print();
}
  }
};
</script>
Contents
Contents