Please send sample code for detailed reference.
To write a chart to a file for use
- Register the callback
on-ready with the nvd3 directive. This callback receives 2 parameters as shown below.
$scope.callback = function(scope,element){ $scope.myChartScope = scope; } $scope.callback = function(scope,element){ $scope.myChartScope = scope; } This $scope.myChartScope must contain a link to your svg element, console.log it, to see its contents
- The parameter object for the line chart has a
dispatch object that has a renderEnd attribute that is called when your chart is fully drawn. In this renderEnd you can access $scope.myChartScope.svg and then do what you want with it.You can use a library, for example https://github.com/exupero/saveSvgAsPng , to save the SVG to an image file. Everything is done on the client side.
Hope this answers your question!
Lxrd-aj
source share