Comments (5)
Hi SD,
It's not necessary to call the capture method again, If you already entered the annotation mode, just if you wish to replace it's context. Therefore you just need to call the "toJPG" method directly like following:
// SAVE TO JPG
chart["export"].toJPG( {}, function( base64 ) {
// LOG IMAGE DATA
console.log( base64 );
// CREATE LINK TO OPEN BASE64 IMAGE IN NEW TAB
var a = document.createElement( "a" );
a.setAttribute( "href", base64 );
a.setAttribute( "target", "_blank" );
a.setAttribute( "style", "display: block; margin-top: 150px;" );
a.innerHTML = "Open embedded base64-image";
var div = document.createElement( "div" );
div.setAttribute( "style", "position: absolute; width: 100%; top:0; bottom: 0; background-color: rgba(255,255,255,.9); z-index: 1337; display: block;text-align: center;" );
div.appendChild( a );
this.setup.chart.div.appendChild( div );
} );
In addition following flag indicates if the chart is currently in annotation mode or not:
chart.export.drawing.buffer.enabled
from export.
Hi,
Your method worked. I changed chart["export"].toJPG to this.toJPG to make it work. However, I am unable to make use of the flag
When I try console.log(chart.export.drawing.buffer.enabled); just to check the result when in Annotation Mode, I get the following error
Uncaught ReferenceError: chart is not defined
When I try console.log(this.chart.export.drawing.buffer.enabled);
Cannot read property 'export' of undefined
When I try console.log(this.export.drawing.buffer.enabled);
Uncaught TypeError: Cannot read property 'drawing' of undefined
Please suggest since I would like to use the below logic
if (chart.export.drawing.buffer.enabled == TRUE) {
logic1;
} else {
logic2;
}
from export.
Please ensure your chart has been initiated / created and the export is ready to be able to check this flag. Following function does that, you just need to pass the instance you want to check:
function chartInAnnotationMode( chart ) {
var plugin = chart["export"] || {
drawing: {
buffer: {
enabled: false
}
}
};
var inAnnotationMode = plugin.drawing.buffer.enabled ? true : false;
return chart.chartCreated && inAnnotationMode;
}
from export.
Hi ,
I couldn't reset the annotations mode.
if (chart.export.drawing.buffer.enabled === true) {
}
I am using the above condition to check whether the chart is in annotations. once the annotated chart is exported , i just want to reset the annotations mode. Could somebody please let me know how to do that?
from export.
Try this:
chart["export"].drawing.handler.done();
from export.
Related Issues (20)
- amcharts-export-canvas class unexpected token HOT 4
- amCharts Export loading error on libraries HOT 5
- Legend items overlap HOT 4
- Failed to export Base64 representation of chart image HOT 1
- How to change language HOT 2
- amcharts annotation options keeps being selected
- amcharts annotation - Custom Path for shapes HOT 2
- amcharts : dynamic loading of themes HOT 3
- amcharts : annotation data object params
- amcharts : ability to export annotation as JSON objects HOT 2
- amcharts : callback isn't fired on chart.export.capture(options, callback) HOT 1
- Using my own buttons to invoke the export (outside of the chart) HOT 2
- Export using black theme causes hard to read text HOT 2
- Column opacity is lost when exporting as PNG HOT 2
- chart export blurs on zoom HOT 8
- export as image in Chrome cannot find canvg function HOT 1
- "exportTitles" does'nt export the value of the title
- Add export property to a created Amchart HOT 3
- Exception when trying to export a chart to PDF HOT 4
- Png graph sometimes gets downloaded cropped
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from export.