Cookie Consent by Free Privacy Policy Generator 📌 9. How to draw a dual-axis chart


✅ 9. How to draw a dual-axis chart


💡 Newskategorie: Programmierung
🔗 Quelle: dev.to

Title

How to draw a dual-axis chart

Describe

What methods can be used to draw a chart with two axes like this?

Solution

In VChart, you can add a right axis and bind the corresponding series to achieve this. Refer to the demo: https://visactor.io/vchart/demo/combination/dual-axis。

Code Example

const spec = {  type: 'common',  seriesField: 'color',  data: [    {      id: 'id0',      values: [        { x: '周一', type: '早餐', y: 15 },        { x: '周一', type: '午餐', y: 25 },        { x: '周二', type: '早餐', y: 12 },        { x: '周二', type: '午餐', y: 30 },        { x: '周三', type: '早餐', y: 15 },        { x: '周三', type: '午餐', y: 24 },        { x: '周四', type: '早餐', y: 10 },        { x: '周四', type: '午餐', y: 25 },        { x: '周五', type: '早餐', y: 13 },        { x: '周五', type: '午餐', y: 20 },        { x: '周六', type: '早餐', y: 10 },        { x: '周六', type: '午餐', y: 22 },        { x: '周日', type: '早餐', y: 12 },        { x: '周日', type: '午餐', y: 19 }      ]    },    {      id: 'id1',      values: [        { x: '周一', type: '饮料', y: 22 },        { x: '周二', type: '饮料', y: 43 },        { x: '周三', type: '饮料', y: 33 },        { x: '周四', type: '饮料', y: 22 },        { x: '周五', type: '饮料', y: 10 },        { x: '周六', type: '饮料', y: 30 },        { x: '周日', type: '饮料', y: 50 }      ]    }  ],  series: [    {      type: 'bar',      id: 'bar',      dataIndex: 0,      label: { visible: true },      seriesField: 'type',      dataIndex: 0,      xField: ['x', 'type'],      yField: 'y'    },    {      type: 'line',      id: 'line',      dataIndex: 1,      label: { visible: true },      seriesField: 'type',      xField: 'x',      yField: 'y',      stack: false    }  ],  axes: [    { orient: 'left', seriesIndex: [0] },    { orient: 'right', seriesId: ['line'], grid: { visible: false } },    { orient: 'bottom', label: { visible: true }, type: 'band' }  ],  legends: {    visible: true,    orient: 'bottom'  }};const vchart = new VChart(spec, { dom: CONTAINER_ID });vchart.renderSync();// Just for the convenience of console debugging, DO NOT COPY!window['vchart'] = vchart;

结果展示

https://visactor.io/vchart/demo/combination/dual-axis

Related Documents

Demo: VisActor

Tutorial:

...

✅ Chart Wars: Pie Chart vs. Sorted Radial Bar Chart


📈 43.25 Punkte

✅ Draw Charts in Laravel Using Alpine.js and Chart.js


📈 31.17 Punkte

✅ How to draw a line chart with a multi-line layout


📈 31.17 Punkte

✅ Chart Wars — Stacked Bar Chart vs. Heatmap


📈 28.84 Punkte

✅ How to use Chart.js to create a Chart for Your Project


📈 28.84 Punkte

✅ Medium CVE-2020-15943: Gantt-chart project Gantt-chart


📈 28.84 Punkte

✅ Low CVE-2020-15944: Gantt-chart project Gantt-chart


📈 28.84 Punkte

✅ The combination chart and line chart are blocked, causing the tooltip to not be hover.


📈 28.84 Punkte

✅ Is dual booting really that dangerous? Do you have any dual boot stories?


📈 17.13 Punkte

✅ Dell Dual Charge Dock (HD22Q) review: A dual-threat dock that's most useful when connected to a Dell laptop


📈 17.13 Punkte

✅ Energizer Energy E12: Dual-Sim, Dual-Cam und SD-Slot für 11,99 Euro


📈 17.13 Punkte

✅ Dual camera & dual display working on MYIR's MYD-JX8MX Dev Board


📈 17.13 Punkte

✅ Was steckt hinter Dual Camera, Dual Pixel & Co.?


📈 17.13 Punkte

✅ Medium CVE-2018-6317: Claymore dual miner project Claymore dual miner


📈 17.13 Punkte

✅ Ford Sync 3 ausprobiert: Mit Dual‑Core und Dual‑Mikro zum besseren Infotainment


📈 17.13 Punkte

✅ Ford Sync 3 ausprobiert: Mit Dual‑Core und Dual‑Mikro zum besseren Infotainment


📈 17.13 Punkte

✅ Steam deck and dual boot with windows or Rog Ally and Dual boot with bazzite OS?


📈 17.13 Punkte

✅ How to draw arrows instead of lines between nodes on a Folium map using NetworkX?


📈 16.75 Punkte

✅ What's the draw with immutable distros and who's the target user?


📈 16.75 Punkte

✅ Sequoia Holdings Says Employees Can Draw Part of Salary in Cryptocurrencies


📈 16.75 Punkte

✅ A my draw (tox)


📈 16.75 Punkte

✅ Epic Pen 3.11.46 - Draw over any application.


📈 16.75 Punkte

✅ Canvas Draw 5.0.0 tiff Parser Out-of-Bounds memory corruption


📈 16.75 Punkte

✅ Chasys Draw IES 4.80.01 Deutsch


📈 16.75 Punkte

✅ ImageMagick bis 6.9.5-4 magick/draw.c DrawImage Pufferüberlauf


📈 16.75 Punkte

✅ CIAM Continues to Draw Attention as Akamai Acquires Janrain


📈 16.75 Punkte

✅ Challenge: Draw with metal-cpp


📈 16.75 Punkte

✅ draw.io 12.5.3 Deutsch


📈 16.75 Punkte

✅ draw.io Desktop 22.1.2 - Diagramming and whiteboarding app.


📈 16.75 Punkte

✅ BMW Backtracks: 'We Do Not Draw on Warranty Status' For Targeted Ads


📈 16.75 Punkte

✅ Researchers Draw Connections Between APTs


📈 16.75 Punkte

✅ Microsoft Cocreator will draw your drawings for you


📈 16.75 Punkte











matomo

Datei nicht gefunden!