Open jonny7 opened 7 years ago
@cvasseng
Which version of the editor are you running? The JSON import has been completely disabled since a few versions. In any case, there's no built-in way of reaching that textarea.
If you just want to programatically load a json configuration object, you could use the editor.chart.data.json()
function. This function accepts either stringified JSON or an object:
var editor = highed.Editor(document.body);
editor.chart.data.json({
title: {
text: 'Hello world!'
}
});
Hi @cvasseng
I'm using the ModalEditor in version: "npm-asset/highcharts-editor": "^1.1.3".
I wasn't sure how to use the above method with the ModalEditor, I get Cannot read property 'data' of undefined
highed.ready(function () {
// modal-btn created in wizard above
highed.ModalEditor("modal-btn", {
allowDone: true,
features: "import templates customize done",
importer: {
options: "json plugins"
},
}, function (chart) {
var html = chart.export.html(true);
highed.dom.get("chart-result").value = html;
});
});
I also noticed yesterday that my way of populating the json import box using:
$(".highed-imp-pastearea:eq(1)").html(result);
Works in IE, but not Chrome or FF
Thank you for your help :-)
Hi @cvasseng Is there any way to access the chart.data with the Modal editor version? UPDATE: I was using last stable version it seems to be implemented in master branch
Please let me know for Modal editor to load chart json in the chart editor to show the exact options selected by which chart is created.
@a3aakash I don't know if I fully understood your question but in order to import project programatically you have to use the function: loadProject
modalEditor.editor.chart.loadProject(jsonProject);
@ravipas87 please refer this issue #151 . I want to know what should be the format for the jsonProject. It will help me out to match the json which is created from my modal editor.
You may generate one importable project just by exporting one testing project when you have one editor available and project test data.
@ravipas87 Sorry but couldnt able to understand your answer. I got stuck in modal editor where I can revert the chart in the editor back again to edit the chart and save again. The json which is being generated from the editor couldnt able to load back and shows blank page as general. So i want to know the exact format for jsonProject.
@ravipas87 @a3aakash @cvasseng - This is for a specific github ticket about a potential problem and how the code works across browsers. It's not a message board. If you can't use the package because you're not sure of how to use it, please go to stackoverflow or highcharts forum (Which I do plenty of times)
If the problem you two are having is because something is broken in the code, then raise a ticket documenting the problem.
Hi
I've just built a little tool gatherer, it creates a json object. The json is valid and works fine. But to streamline the process of copying and pasting the returned json. I've created a button that launches the modal editor, on the click of this button the json is appended into the textarea node and displays in my DOM when I look through developer tools. But on screen I just get
{}
.What am I doing wrong, or is there a better way to do this?
See screenshot
Updated
I should add that this works fine if I want to copy my return JSON string into the CSV import box. The problem I think (for me) is maybe this line in the dataimporter.
jsonPasteArea.value = JSON.stringify({}, undefined, 2);