有没有办法在highcharts js图表中添加网格线但在现有线之间没有标签?
我已经拥有值为1,2,3等的网格线,我会添加0.5,1.5,2.5等行,但轴上没有标签。
另外,我需要计算间隔(每次可能不同的步骤之间的中间点)。
答案 0 :(得分:2)
您可以启用次要刻度并将其 if (count($_FILES['field2']['name']) >= 1) {
//Loop through each file
for ($i = 0; $i < count($_FILES['field2']['name']); $i++) {
//Get the temp file path
$tmpFilePath = $_FILES['field2']['tmp_name'][$i];
//Make sure we have a filepath
if ($tmpFilePath != "") {
//save the filename
$shortname = $_FILES['field2']['name'][$i];
//save the url and the file
$filePath = "uploads/" . date('d-m-Y-H-i-s') . '-' . $_FILES['field2']['name'][$i];
$filePath1 = "uploads/" . date('d-m-Y-H-i-s') . '-' . $_FILES['field2']['name'][$i];
//Upload the file into the temp dir
if (move_uploaded_file($tmpFilePath, $filePath)) {
$sql = "INSERT INTO " . $config_tbl_prefix . " subcontractor_qs (field1, field2)
VALUES
('$filePath','$filePath1')";
mysql_query($sql);
}
}
}
}
}
设置为0.5。
API参考:
http://api.highcharts.com/highcharts/yAxis.minorTickInterval
答案 1 :(得分:0)
选中yAxis.plotLines以添加其他网格线
Fiddle演示
Highcharts.chart('container', {
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
},
yAxis: {
tickPositions: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], //fix labels in yAxis
plotLines: [{
color: '#ccc',
width: 1,
value: 0.5 //position where line needed
}, {
color: '#ccc',
width: 1,
value: 1.5
}, {
color: '#ccc',
width: 1,
value: 2.5
}]
},
series: [{
data: [1, 2, 3, 3, 4, 5, 6, 7, 8, 9, 10]
}]
});
&#13;
<script src="https://code.highcharts.com/highcharts.js"></script>
<div id="container" style="height: 400px"></div>
&#13;