<?php
/*
 * @Author: Yangshuimiao
 * @Date: 2023-06-25 12:26:16
 * @LastEditTime: 2025-02-13 17:04:36
 * @FilePath: \chartFore.php
 * @Description: 
 * Copyright 2025 Yangshuimiao, All Rights Reserved. 
 */
#查询个股价格对应PE_TTM, PB, PS的长期趋势数据
include_once "inc/getBasic.inc.php" ;
include_once "inc/getData.inc.php";
include_once "html/headChart.php"; //required after $ts_code and $ts_name,maybe doesn't matter
$ts_code=ts_code_conv($_REQUEST['ts_code']);
$day_st=($_REQUEST['s']=='')?'20120101':$_REQUEST['s'];
$day_end=($_REQUEST['e']=='')?date('Ymd'):$_REQUEST['e'];
$item = ($_REQUEST['item']=='')?'pe_ttm':$_REQUEST['item'];
$unit = '';   # Without a unit on PE
$data = getStockHist($ts_code,$day_st,$day_end);
#$data = getIndexHistoryDataByTS($ts_code, $day_st, $day_end);
$data2 = getBasicData($ts_code,$day_st,$day_end,$item);
#$data2 = getStockHistoryDataByTS($ts_code, $day_st, $day_end, $item);

//print_r($data2);
//print_r($data);
$subtext_ext = "Max: ".$data2['data_max'];
$subtext_ext .= ", Min: ".$data2['data_min'];
$subtext_ext .= ", Average: ".$data2['data_avg'];
$subtext_ext .= ", Recent: ".$data2['data_last'];
$ts_name = tscodeToName($ts_code);
$legend=array('不复权股价','深证成指',strtoupper($item));
#$value=json_encode($data['data']);
?>

<script type="text/javascript">
    var data1 = <?php echo json_encode($data['data']); ?>;
    var data2 =<?php echo json_encode($data2['data']); ?>;
    var legend = <?php echo json_encode($legend);?>;
    var unit ='<?php echo $unit; ?>';
    var headtxt = '<?php echo $ts_name.'('.$ts_code.')'; ?>';
    var subtxt = '<?php echo $subtext_ext; ?>';
</script>
<script type="text/javascript" src="js/chartFore.js?ver=3.14"></script>
   </body>
</html>