c3js / c3js/c3

XY Plot - axis.min not working and X-axis is not showing values

Open
#1,905 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
9.3k
Forks
1.4k
Avg merge
6d 16h
Merged PRs (30d)
1

Description

- My Code

```
var chart = c3.generate({
bindto: '#CompareMeasurement',
size: {
width: 800,
height: 500
},
data: {
onclick: function (d, element) {
return swal("Voltage : " + JSON.stringify(d.x) + " mV" + "\nCurrent : " + JSON.stringify(d.value) + " mA");
},
type: 'line',
xs:{
Simulated_Current:"Simulated_Voltage",
Measured_Current:"Measured_Voltage"
},
columns: [
["Simulated_Current",38.8,38.8,38.8,38.8,38.8,38.8,38.8,38.8,38.8,38.8,38.8,38.8,38.8,38.8,38.8,38.8,38.8,38.8,38.8,38.8,38.8,38.8,38.8,38.8,38.8,38.8,38.8,38.8,38.8,38.8,38.8,38.8,38.8,38.7,38.7,38.6,38.5,38.3,38,37.7,37.3,36.9,36.4,35.9,35.4,34.8,34.2,33.5,32.9,32.2,31.6,30.9,30.2,29.5,28.8,28.1,27.4,26.7,26,25.2,24.5,23.8,23,22.3,21.6,20.8,20.1,19.3,18.6,17.8,17.1,16.3,15.6,14.8,14.1,13.3,12.5,11.8,11,10.2,9.5,8.7,7.9,7.2,6.4,5.6,4.9,4.1,3.3,2.6,1.8,1,0.2,-0.5,-1.3,-2.1,-2.8,-3.6,-4.4], // ['Current',1,2,2]
["Simulated_Voltage",-8.1,7.9,23.9,39.9,55.9,71.9,87.9,103.9,119.9,135.9,151.9,167.9,183.9,199.9,215.9,231.9,247.9,263.9,279.9,295.9,311.9,327.9,343.9,359.9,375.9,391.9,407.9,423.8,439.8,455.8,471.7,487.5,503.2,518.6,533.6,548,561.5,573.8,584.8,594.5,602.9,610.2,616.6,622.1,627,631.3,635.2,638.7,641.9,644.8,647.5,650,652.2,654.4,656.4,658.2,660,661.7,663.2,664.7,666.2,667.5,668.8,670.1,671.3,672.4,673.5,674.6,675.6,676.6,677.5,678.4,679.3,680.2,681,681.9,682.6,683.4,684.2,684.9,685.6,686.3,687,687.6,688.3,688.9,689.5,690.1,690.7,691.3,691.9,692.4,693,693.5,694,694.5,695,695.5,696], // ['Voltage',1,2,2]
["Measured_Current",165.2,165.1,165,165,165.1,165,164.9,164.9,164.9,164.8,164.8,164.8,164.8,164.8,164.7,164.7,164.7,164.6,164.6,164.6,164.6,164.5,164.5,164.5,164.5,164.4,164.4,164.4,164.4,164.3,164.3,164.3,164.3,164.3,164.2,164.2,164.2,164.2,164.1,164.2,164.1,164.1,164.1,164.1,164.1,164,164,164,164,163.9,163.9,163.9,163.9,163.8,163.8,163.8,163.8,163.8,163.8,163.8,163.8,163.7,163.6,163.7,163.7,163.6,163.6,163.6,163.6,163.5,163.6,163.6,163.5,163.5,163.5,163.5,163.5,163.4,163.5,163.5,163.4,163.4,163.4,163.4,163.4,163.4,163.3,163.4,163.3,163.2,163.3,163.3,163.2,163.2,163.2,163.2,163.2,163.2,163.2,163.2,163.1,163.1,163.1,163.1,163.1,163.1,163.1,163.1,163,163,163.1,163,162.9,162.3,162.4,163.1,163,163.1,162.9,163,163,163,162.9,162.9,162.9,163,162.9,162.9,162.9,162.9,162.9,162.9,162.9,162.9,162.8,162.8,162.8,162.9,162.8,162.8,162.8,162.8,162.8,162.8,162.8,162.8,162.8,162.7,162.7,162.7,162.7,162.7,162.7,162.7,162.7,162.7,162.7,162.6,162.6,162.6,162.6,162.6,162.6,162.6,162.6,162.6,162.6,162.6,162.6,162.6,162.5,162.6,162.6,162.6,162.5,162.6,162.6,162.5,162.5,162.5,162.6,162.5,162.5,162.5,162.5,162.5,162.4,162.5,162.5,162.5,162.4,162.5,162.5,162.5,162.4,162.5,162.5,162.5,162.4,162.5,162.5,162.4,162.4,162.5,162.5,162.4,162.4,162.5,162.5,162.4,162.4,162.4,162.5,162.4,162.4,162.4,162.5,162.4,162.4,162.4,162.4,162.4,162.4,162.4,162.4,162.3,162.3,162.4,162.4,162.3,162.4,162.4,162.4,162.4,162.3,162.4,162.4,162.4,162.3,162.3,162.4,162.3,162.3,162.4,162.4,162.3,162.3,162.4,162.4,162.3,162.3,162.3,162.4,162.3,162.3,162.3,162.3,162.4,162.4,162.3,162.3,162.4,162.4,162.4,162.3,162.4,162.3,162.3,162.4,162.3,162.3,162.3,162.3,162.3,162.4,162.3,162.4,162.4,162.3,162.3,162.3,162.3,162.3,162.3,162.4,162.2,162.3,162.2,162.3,162.3,162.4,162.3,162.3,162.3,162.2,162.3,162.4,162.3,162.3,162.2,162.3,162.4,162.3,162.2,162.3,162.3,162.2,162.2,162.3,162.3,162.3,162.2,162.3,162.3,162.3,162.2,162.3,162.3,162.3,162.2,162.3,162.3,162.3,162.3,162.3,162.3,162.3,162.3,162.3,162.3,162.3,162.3,162.4,162.4,162.3,162.3,162.3,162.3,162.3,162.3,162.3,162.3,162.3,162.3,162.3,162.3,162.3,162.2,162.3,162.3,162.3,162.3,162.3,162.3,162.3,162.3,162.4,162.4,162.3,162.3,162.3,162.3,162.3,162.3,162.3,162.4,162.3,162.4,162.3,162.4,162.3,162.4,162.4,162.4,162.3,162.4,162.4,162.4,162.3,162.3,162.4,162.4,162.4,162.4,162.4,162.4,162.3,162.4,162.4,162.4,162.3,162.4,162.4,162.3,162.4,162.4,162.4,162.4,162.3,162.4,162.4,162.4,162.4,162.4,162.4,162.4,162.4,162.4,162.4,162.4,162.4,162.4,162.4,162.4,162.4,162.4,162.4,162.4,162.3,162.4,162.4,162.4,162.4,162.4,162.4,162.4,162.4,162.4,162.4,162.4,162.3,162.4,162.4,162.4,162.3,162.4,162.3,162.4,162.3,162.3,162.4,162.3,162.3,162.3,162.3,162.3,162.3,162.4,162.3,162.2,162.2,162.3,162.3,162.2,162.2,162.3,162.3,162.2,162.2,162.2,162.2,162.2,162.2,162.2,162.2,162.2,162.2,162.3,162.2,162.2,162.2,162.2,162.2,162.2,162.2,162.2,162.2,162.1,162.2,162.2,162.1,162.1,162.2,162.2,162.1,162.1,162.1,162.2,162.1,162,162.1,162.2,162.1,162,162.2,162.1,162.1,162.1,162.1,162.1,162,162,162,162.1,161.9,161.9,162,162,161.9,161.8,161.9,161.9,161.7,161.7,161.7,161.7,161.5,161.4,161.3,161.2,161,160.9,160.8,160.6,160.4,160.1,159.8,159.5,159.1,158.6,158.1,157.5,156.7,155.9,154.7,153.5,151.8,149.8,147.3,144.6,141.3,137.4,132.6,127.7,122,115.6,108.5,101.5,93.7,85.4,76.5,67.9,58.6,48.7,38.4,28.9,18.6,7.8,-3.3,-13.4,-24.4,-35.8,-48.1,-58.7,-70.9,-83.3,-95.8,-106.3,-118.1,-130.4,-142.6,-152.9,-166.3,-179.4,-192.4,-203.3,-216.2,-229.3,-242,-252.4,-265,-278,-290.8,-302,-315.3,-329.3,-342.8,-354.1,-367.2,-380.6,-393.3,-404,-416.7,-430.3,-443.8,-455.3,-468.8,-483,-496.4], // ['Current',1,2,2]
["Measured_Voltage",-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.4,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2048.3,-2041.5,-2029.3,-2017.1,-2013.3,-2004.3,-1988.8,-1980.7,-1977.7,-1976.8,-1962.1,-1946.7,-1927.4,-1914.3,-1902.3,-1897,-1891.8,-1880,-1859.3,-1848.6,-1839.6,-1838.3,-1819,-1807.8,-1806.8,-1797.8,-1788.3,-1787.1,-1769.3,-1751,-1733.2,-1730.4,-1725.2,-1720.9,-1711.1,-1705,-1703.8,-1700.9,-1691.1,-1683.1,-1673.5,-1663.8,-1654.5,-1651,-1646.6,-1637.3,-1627.6,-1618.4,-1610.6,-1601.6,-1592.1,-1583.1,-1574.9,-1565.4,-1555.6,-1546.2,-1537.7,-1528.4,-1519,-1509.9,-1501.8,-1492.8,-1483.4,-1474.4,-1466.4,-1457.3,-1448,-1439,-1430.4,-1420.8,-1410.9,-1400.5,-1391.7,-1382.3,-1372.9,-1364,-1355.4,-1346.5,-1337.2,-1328.1,-1319.2,-1310,-1300.4,-1291.4,-1282.9,-1274.2,-1265.2,-1256.9,-1248.4,-1239.6,-1230,-1221.1,-1212.2,-1203,-1193.5,-1184.7,-1175.7,-1166.5,-1157.1,-1148.5,-1139.6,-1130.4,-1121,-1112.7,-1103.8,-1094.6,-1084.6,-1076.5,-1067.5,-1058.4,-1049.1,-1040.7,-1031.2,-1021.8,-1012.1,-1004,-994.5,-984.8,-975.2,-967.2,-957.9,-948.4,-939.2,-931.7,-922.7,-913.4,-904.3,-896.4,-887.1,-877.2,-867.7,-860,-850.5,-840.6,-831.2,-823.2,-813.9,-803.7,-793.9,-785.6,-775.8,-764.8,-755.1,-747.3,-738,-728.2,-718.9,-711,-701.6,-691.8,-682.3,-674.1,-664.7,-655.1,-645.8,-637.8,-628.6,-619.2,-610,-601.9,-592.7,-583.1,-574.1,-565.8,-556.4,-546.5,-537.1,-528.3,-518.9,-509,-499.5,-490.4,-480.7,-470.8,-461.4,-452.8,-443.8,-433.7,-424.9,-416.1,-407.2,-398,-389.2,-380.7,-371.7,-362.1,-352.7,-343.4,-333.8,-323.9,-315,-306.1,-297,-287.7,-279.1,-270.3,-260.8,-251,-242.1,-232.6,-223,-213.4,-205.1,-196.1,-187,-177.7,-169.5,-160.2,-150.6,-140.9,-132.6,-123.3,-113.1,-103.4,-95.3,-86.1,-76.5,-67,-59.1,-49.8,-40.2,-30.7,-22.8,-13.4,-3.7,5.7,13.6,23,33,42.9,50.9,60.5,70.5,80,87.8,97.2,107,116.4,124.3,133.9,144.2,153.8,162,171.6,180.9,190.1,198.1,208.1,217.9,227.4,235.6,245.1,255,264.3,272.6,282,291.8,301.1,309.6,318.8,328.9,338.6,347.4,357.1,367,376.4,384.9,394,403.6,412.6,421.2,430.4,439.9,448.8,457.5,466.5,475.7,484.5,492.9,501.5,510.3,518.3,526.8,534.7,542.6,549.7,556.5,563.3,569.9,575.7,581.2,586.6,591.7,596.2,600.6,604.8,608.9,612.5,616,619.5,622.8,625.8,628.8,631.7,634.6,637,639.5,642.1,644.8,647,649.4,651.7,654.1,656,658,660.1,662.1,663.8,665.9,667.9,669.9,671.5,673.4,675.3,677,678.4,680.2,681.8,683.5,684.9,686.6,688.4,690,691.4,692.9,694.5,695.9,697.2,698.7,700.1,701.6,702.8,704.3,705.8,707.2] // ['Voltage',1,2,2]
]
},
subchart: {
show: true
},
axis: {
x: {
min: 0,
max: 693.133,
padding: {top: 5, bottom: 10, left: 10, right: 5},
show: true,
label: {
text: 'Voltage (mV)',
position: 'inner-center'
// inner-right : default
// inner-center
// inner-left
// outer-right
// outer-center
// outer-left
}
},
y: {
min: 0,
max: 162.175,
padding: {top: 5, bottom: 5, left: 5, right: 5},
show: true,
label: {
text: 'Current (mA)',
position: 'outer-right'
// inner-right : default
// inner-center
// inner-left
// outer-right
// outer-center
// outer-left
}
}
},
zoom: {
enabled: true,
rescale: true
},
point: {
show: true,
r: 4,
focus: {
expand: {
enabled: true,
r: 12
}
}
},
color: {
pattern: ['#d87524','#f4d142', '#000000', '#f44242']
},
interaction: {
enabled: true
}
});

setTimeout(function() {
chart.load({
xs: {
Current_MaxPowerPoint_Simulated: 'VmppCSimulated',
Current_MaxPowerPoint_Uploaded: 'VmppC'
},
columns: [
["VmppCSimulated", 660.665],
["Current_MaxPowerPoint_Simulated", 23.7239],
["VmppC", 533.956],
["Current_MaxPowerPoint_Uploaded", 149.988]
],
type: 'scatter'
});
}, 1000);
```
- Screenshot

screen shot 2016-12-13 at 4 04 09 pm

# Issue

- The points on x-axis are not shown for all value. How to show all of them?
- I have defined the min for both x/y axis to be zero but I can still see values that are in minus such as -3.7 and -8 etc. How to fix this?

# Link to JSFiddle

- https://jsfiddle.net/ga1989/3p00j54j/1/

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.