我使用amcharts库制作折线图。我只想在图表中显示折线,但显示的是山脉类型的视图。我搜索了很多,但找不到任何解决方案。
这是我的图表的屏幕截图:
您可以在图像中看到它像山一样显示,我只想显示线条。
这是我的图表的标题:
<script>
var chart8;
var chartData8 = [
<?php
$qry = "select DIVISION_NAME, sum(DISPATCH_QTY) DISPATCH_QTY,sum(TARGET_QTY)
TARGET_QTY,sum(DISPATCH_QTY)-sum(TARGET_QTY) BALANCE_QTY from (
SELECT TO_CHAR(A.GP_MONTH_APP_FDATE,'MON-RR') DISPATCH_MONTH, A.DIVISION_ID, A.DIVISION_NAME ,
A.GROUP_ID, NVL(B.TARGET_GROUP_NAME,'Others') GROUP_NAME, NVL(B.TARGET_QTY,0) TARGET_QTY,
A.DISPATCH_QTY,
NVL(B.TARGET_QTY,0) - NVL(A.DISPATCH_QTY,0) BALANCE_QTY,
ROUND( (NVL(b.TARGET_QTY,0)/1000000), 2) AS TARGET_QTY_MLN, ROUND( (NVL(A.DISPATCH_QTY,0)/1000000)
,2) AS DISPATCH_QTY_MLN, ROUND( (NVL(NVL(B.TARGET_QTY,0) - NVL(A.DISPATCH_QTY,0),0)/1000000), 2)
BALANCE_QTY_MLN
FROM(
SELECT A.GP_MONTH_APP_FDATE, A.MARKET_SRNO DIVISION_ID, A.ZONE DIVISION_NAME, A.GROUP_ID,
SUM(A.QUANTITY_OUT2) DISPATCH_QTY
FROM GATEPASS.V_DISPATCH_TRX A, GATEPASS.GP_TRN_MST B
WHERE 1=1
AND A.GP_SUB_TYPE = 1
AND A.MST_STATUS = 'O'
AND A.REQUEST_TYPE = 'OGP'
AND A.GP_NO = B.GDR (+)
AND TO_CHAR(A.APPROVED_DATE,'MON-RRRR') = '$fdate'
and ( A.MARKET_SRNO = $division OR $division = 0 )
GROUP BY A.MARKET_SRNO, A.ZONE, A.GP_MONTH_APP_FDATE, A.GROUP_ID
) A, ( SELECT A.DIVISION_ID TARGET_DIVISION_ID, A.DIVISION TARGET_DIVISION_NAME, A.GROUP_ID
TARGET_GROUP_ID, B.GROUP_NAME TARGET_GROUP_NAME, B.ORDER_ID, A.TRN_DATE TARGET_MONTH,
A.ALOCATED_QTY TARGET_QTY
FROM PROD.MONTH_WISE_DIVISION_TARGET A, GATEPASS.DISPATCH_GROUP B WHERE A.GROUP_ID = B.GROUP_ID )
B
WHERE A.GP_MONTH_APP_FDATE = B.TARGET_MONTH (+)
AND A.DIVISION_ID = B.TARGET_DIVISION_ID (+)
AND A.GROUP_ID = B.TARGET_GROUP_ID (+)
ORDER BY A.DIVISION_NAME, B.TARGET_GROUP_NAME) where DIVISION_NAME not in('RND')
group by DIVISION_NAME";
$result = $db->select($qry);
?>
<?php foreach ($result as $val) {
?>
{
"Division": '<?php echo $val['DIVISION_NAME'] ?>',
"Target": '<?php echo number_format($val['TARGET_QTY']/1000000,2) ?>',
"Actual": '<?php echo number_format($val['DISPATCH_QTY']/1000000, 2) ?>',
"Difference": '<?php echo number_format($val['BALANCE_QTY']/1000000, 2) ?>'
},
<?php } ?>
];
AmCharts.ready(function () {
// SERIAL CHART
chart8 = new AmCharts.AmSerialChart();
chart8.dataProvider = chartData8;
chart8.categoryField = "Division";
chart8.startDuration = 1;
chart8.depth3D = 50;
chart8.angle = 45;
chart8.marginRight = 80;
chart8.plotAreaBorderColor = "#DADADA";
// chart3.plotAreaBorderColor = "#DADADA";
chart8.plotAreaBorderAlpha = 0;
//chart8.responsive.enabled = true;
// this single line makes the chart a bar chart
//chart3.rotate = true;
AmCharts.addInitHandler( function ( chart ) {
// set base values
var categoryWidth = 50;
// calculate bottom margin based on number of data points
var chartHeight = categoryWidth * chart.dataProvider.length;
// set the value
chart.div.style.height = chartHeight + 'px';
}, ['serial'] );
// AXES
// Category
var categoryAxis = chart8.categoryAxis;
categoryAxis.gridPosition = "start";
categoryAxis.labelRotation = 45; // this line makes category values to be rotated
categoryAxis.gridAlpha = 0;
categoryAxis.axisAlpha = 0;
categoryAxis.color = 'red';
// Value
var valueAxis = new AmCharts.ValueAxis();
valueAxis.axisAlpha = 0;
valueAxis.gridAlpha = 0.5;
tickLength: 0;
// valueAxis.minimum = 0;
// valueAxis.maximum = 3.5;
valueAxis.position = "bottom";
valueAxis.color = '';
chart8.addValueAxis(valueAxis);
// GRAPHS
// second graph
var graph9 = new AmCharts.AmGraph();
graph9.type = "<?php echo $chart_type ?>";
graph9.title = "Target";
graph9.valueField = "Target";
graph9.balloonText = "Target:[[value]]";
graph9.lineAlpha = 0;
graph9.fillColors = ["#FFD244"];
graph9.fillAlphas = 1;
graph9.labelText = '[[value]]';
graph9.labelRotation = 360;
graph9.labelPosition = 'top-bottom'; // change to inside
graph9.color = '#000';
graph9.labelColorField = '#FFFFFF';
chart8.addGraph(graph9);
// first graph
var graph8 = new AmCharts.AmGraph();
graph8.type = "<?php echo $chart_type ?>";
graph8.title = "Actual";
graph8.valueField = "Actual";
graph8.balloonText = "Actual:[[value]]";
graph8.lineAlpha = 0;
graph8.fillColors = ["#ee8989"];
graph8.fillAlphas = 1;
graph8.labelText = '[[value]]';
graph8.labelRotation = 360;
graph8.labelPosition = 'top-bottom'; // change to inside
graph8.marginRight = 10;
graph8.color = '#000';
graph8.labelColorField = '#FFFFFF';
chart8.addGraph(graph8);
if (graph8.type == 'column' && graph8.type == 'line') {
var graph10 = new AmCharts.AmGraph();
graph10.type = "<?php echo $chart_type ?>";
graph10.title = "Difference";
graph10.valueField = "Difference";
graph10.balloonText = "Difference:[[value]]";
graph10.lineAlpha = 0;
graph10.fillColors = ["#6acb5f"];
graph10.labelText = '[[value]]';
graph10.labelRotation = 360;
graph10.labelPosition = 'top-bottom';
graph10.marginRight = 10;
graph10.fillAlphas = 1;
graph10.color = '#000';
graph10.labelColorField = '#FFFFFF';
chart8.addGraph(graph10);
}
// LEGEND
// var legend = new AmCharts.AmLegend();
// chart8.addLegend(legend);
// legend.
// console.log(legend);
var legend = new AmCharts.AmLegend();
legend = new AmCharts.AmLegend();
legend.position = "bottom";
legend.align = "center";
legend.markerType = "circle";
// legend.labelText = '[[title]]';
chart8.addLegend(legend);
chart8.creditsPosition = "top-right";
// WRITE
chart8.write("dailyprod");
});
</script>
请帮助我摆脱这个问题。谢谢