Hello, is the Everviz API having problems? I’m trying to generate a chart and it’s returning a 200 status code, but it’s not giving me any data or creating the chart on the Everviz platform. This problem started occurring this morning. Can someone help me?
“data”: {
“status”: 200,
“statusText”: “OK”,
“data”: “”
}
Hi Eder Dias, what does the HTTP request you’re sending in look like? This will help us reproduce
Hello Kluvin, this is the request I was making, remembering that it was working, and now it’s not anymore.
const options = {
method: 'POST',
url: `${process.env.BASE_URL}/team/${teamId}/chart`,
headers: {
'Content-Type': 'application/json',
'X-API-Key': process.env.API_KEY,
// sessionid: SESSION_ID
},
data: {
data: JSON.stringify(PIE),
referenced: 0,
name: 'PORTFOLIO TESTE',
}
}
return await axios.request(options)
.then((response) => {
return {
status: response.status,
statusText: response.statusText,
data: response.data,
}
}).catch((error) => {
console.log(error)
return {
code: error.code,
status: error.status,
message: error.message
}
});
What does the variable PIE
look like?
Hi, PIE is the Highcharts framework, just like the one you provided as an example in the documentation. I would like to point out that although I am receiving a status 200 when creating a chart, it is not returning the response data, nor is it creating the chart on the Everviz platform.
const PIE = {
options: {
title: { text: '', align: 'left', style: { color: '#000000' } },
subtitle: {
text: '',
align: 'left',
style: { color: '#000000' },
},
caption: { style: { color: '#000000' } },
credits: {
style: { color: '#000000' },
text: '',
href: '',
enabled: false,
},
chart: {
style: { fontFamily: 'FiraSans-Bold' },
type: 'pie',
polar: false,
backgroundColor: '#FFFFFF',
},
plotOptions: {
series: {
borderRadius: 2,
pointPadding: 0.01,
groupPadding: 0.05,
borderWidth: 0,
shadow: false,
marker: { enabled: false },
lineWidth: 3,
dataLabels: {
enabled: true,
format: '{point.y:.1f}%',
style: {
fontFamily: 'Fira Sans ExtraLight',
textOutline: '2 contrast contrast',
fontWeight: 'bold',
},
},
states: {
select: {
color: '#EFFFEF',
borderColor: 'black',
dashStyle: 'solid',
},
},
label: { enabled: false },
animation: { duration: 0 },
},
pie: {
allowPointSelect: false,
cursor: true,
innerSize: '60%',
showInLegend: true,
dataLabels: { enabled: true, format: '{point.y:.1f}%' },
},
},
series: [
{
colorByPoint: true,
minPointSize: 10,
innerSize: '60%',
zMin: 0,
data: [
{
name: 'CDI +',
y: 54.3,
},
{
name: 'IPCA +',
y: 43.7,
},
{
name: 'Pré-Fixado',
y: 2.0,
},
],
},
],
legend: {
align: 'center',
verticalAlign: 'bottom',
itemMarginBottom: 10,
x: 0,
symbolRadius: 8,
enabled: true,
itemStyle: {
fontFamily: 'Fira Sans ExtraLight',
fontSize: '12px',
color: '#2c2621',
},
symbolHeight: 8,
},
yAxis: {
title: { style: { color: '#000000' } },
labels: { style: { color: '#000000' }, format: ' {value}% ' },
},
xAxis: {
title: { style: { color: '#000000' } },
labels: { style: { color: '#000000' } },
},
loading: { labelStyle: { fontStyle: 'bold' } },
lang: {
shortMonths: [
'Jan',
'Feb',
'Mar',
'Apr',
'May',
'Jun',
'Jul',
'Aug',
'Sep',
'Oct',
'Nov',
'Dec',
],
weekdays: [
'Sunday',
'Monday',
'Tuesday',
'Wednesday',
'Thursday',
'Friday',
'Saturday',
],
months: [
'January',
'February',
'March',
'April',
'May',
'June',
'July',
'August',
'September',
'October',
'November',
'December',
],
numericSymbols: ['k', 'M', 'G', 'T', 'P', 'E'],
},
exporting: { useMultiLevelHeaders: false, enabled: false },
tooltip: {
valuePrefix: ' ',
valueSuffix: ' ',
headerFormat:
'<span style="font-size:11px">{series.name}</span><br>',
pointFormat:
'<span style="color:{point.color}">{point.name}</span>: <b>{point.y:.2f}%</b><br/>',
},
everviz: { animation: { loadOnPageLoad: true } },
stockTools: {
gui: { buttons: ['simpleShapes', 'lines'], enabled: false },
},
navigationBindings: {},
navigation: {
events: {
showPopup:
'function(t){var n=t.annotation,r=(this.chart.annotations||[]).findIndex((function(e){return e===n}));I_.dispatch((0,Ve.Zj)({type:n.labels&&n.labels.length>0?"label":"shape",index:r,annotation:n})),this.chart.indicatorsPopupContainer||(this.chart.indicatorsPopupContainer=document.getElementsByClassName("highcharts-popup-indicators")[0]),"indicators"===t.formType?this.chart.indicatorsPopupContainer.style.display="block":"annotation-toolbar"===t.formType&&(this.chart.activeButton||(this.chart.currentAnnotation=t.annotation)),this.popup&&(e=this.popup)}',
closePopup: 'function(){this.chart.currentAnnotation=null}',
selectButton:
'function(e){var t=e.button.className+" highcharts-active";e.button.classList.contains("highcharts-active")||(e.button.className=t,this.chart.activeButton=e.button)}',
deselectButton:
'function(e){e.button&&e.button.classList.remove("highcharts-active"),this.chart.activeButton=null}',
},
bindingsClassName: 'tools-container',
},
responsive: {
rules: [
{
condition: { maxWidth: 560 },
chartOptions: {
plotOptions: {
pie: {
dataLabels: { enabled: true },
showInLegend: true,
},
},
legend: {
layout: 'vertical',
align: 'center',
verticalAlign: 'bottom',
floating: false,
itemMarginBottom: 10,
},
title: {
floating: false,
verticalAlign: 'top',
align: 'left',
x: 0,
},
chart: { spacing: [0, 0, 0, 0] },
yAxis: [{ labels: { align: 'left ', x: 0, y: -2 } }],
},
},
],
},
},
theme: {},
settings: {}
};
Are you able to run the example in the documentation?
There’s a lot of things going on in your provided example. I fear, if something is tripping everviz up, it might be there. If you can provide a minimal example that demonstrates the issue, I can show it to the technical department.
OK, I will do that. I will put together a simple example and send it here.
This is my simple example; however, I continue to obtain the same result: status 200, and the response data is empty.
const teamId = 0
const apiKey = ''
const simple = {
options: {
chart: {
type: 'pie'
},
title: {
text: 'My chart'
},
data: {
csv: '"Name","Value"\n"A",60\n"B",40',
seriesMapping: [{
x: 0,
y: 1
}],
}
},
settings: {
},
theme: {
id: ''
}
}
const options = {
method: 'POST',
url: `https://api.everviz.com/team/${teamId}/chart`,
headers: {
'Content-Type': 'application/json',
'X-API-Key': apiKey,
// sessionid: SESSION_ID
},
data: JSON.stringify({
data: simple,
name: "Simple Chart",
referenced: 0,
})
}
You need to stringify your chart configuration:
data: JSON.stringify({
data: JSON.stringify(simple),
name: "Simple Chart",
referenced: 0,
})
and also duplicate:
simple.settings.dataProvider = simple.options.data
from our docs API Quickstart - everviz Knowledge Base
Hello Kluvin, I apologize for the delay in responding.
Your solution worked; thank you very much for the assistance. I have a question: is it possible to insert tags through the API?
We have a route that allows you to fetch the tags in your team with their ids, and a chartmeta, which allows you to set project metadata.