Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

227
Views
mostrar dos datos de columnas apiladas diferentes en un gráfico canvasjs reacciona

Quiero dos datos de columnas apiladas en un gráfico usando canvasjs como este: ingrese la descripción de la imagen aquí

Actualmente he hecho algo como esto con las opciones: esto logra eliminar el eje x y el eje y secundario y mostrar dos datos juntos

 { animationEnabled: true, options:{ scales: { xAxes: [{ stacked:true}] } }, axisY: { titleFontColor: "#4F81BC", lineColor: "#4F81BC", labelFontColor: "#4F81BC", tickColor: "#4F81BC", margin:24, }, axisY2: { gridThickness: 0, tickLength: 0, lineThickness: 0, margin:24, labelFormatter: function(){ return " "; } }, axisX:{ gridThickness: 0, tickLength: 0, lineThickness: 0, margin:24, labelFormatter: function(){ return " "; } }, toolTip: { shared: true }, legend: { cursor:"pointer", }, data: [{ type: "stackedColumn", name: "Proven Oil Reserves (bn)", legendText: "Proven Oil Reserves", showInLegend: false, dataPoints:[ { y: 30.25 }, ] }, { type: "stackedColumn", name: "Oil Production (million/day)", legendText: "Oil Production", showInLegend: false, dataPoints:[ { y: 17.46 }, ] }, { type: "stackedColumn", name: "Oil Production (million/day)", legendText: "Oil Production", axisYType:"secondary", margin:10, showInLegend: false, dataPoints:[ { y: 10.46 }, ] }, { type: "stackedColumn", name: "Oil Production (million/day)", legendText: "Oil Production", axisYType:"secondary", margin:10, showInLegend: false, dataPoints:[ { y: 10.46 }, ] } ] }

produce el resultado como: ingrese la descripción de la imagen aquí

lo que necesito es

  1. dar margen entre dos conjuntos de datos
  2. capaz de etiquetar conjuntos de datos con texto sobre ellos como se ve en la imagen de arriba
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

dar margen entre dos conjuntos de datos

Habrá una brecha entre los puntos de datos cuando los valores de x sean diferentes.

capaz de etiquetar conjuntos de datos con texto sobre ellos como se ve en la imagen de arriba

Puede utilizaretiquetas de índice . Consulte CanvasJS Docs para obtener más información/ejemplos. A continuación se muestra un ejemplo de trabajo.

 var chart = new CanvasJS.Chart("chartContainer", { animationEnabled: true, axisX:{ gridThickness: 0, tickLength: 0, lineThickness: 0, labelFormatter: function(){ return ""; } }, axisY: { includeZero: true, tickLength: 0, lineThickness: 0, gridColor: "#ddd", labelFormatter: function(e) { return ""; } }, toolTip: { shared: true }, data: [{ type: "stackedColumn", indexLabel: "RM xyz", indexLabelFontColor: "#fff", dataPoints: [ { x: 1, y: 47, color: "#c63531" }, { x: 2, y: 32, color: "#449fc7" } ] }, { type: "stackedColumn", indexLabel: "RM xyz", indexLabelFontColor: "#fff", dataPoints:[ { x: 1, y: 32, color: "#bb8786" }, { x: 2, y: 27, color: "#74ab3e" } ] }] }); chart.render();
 <script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script> <div id="chartContainer" style="height: 300px; width: 100%;"></div>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!