dpxw17759 2015-05-22 07:59
浏览 36
已采纳

以高图显示分数值

In high chart Y axis i want to show some fraction values like 100/50, 100/70 100/90

Is it possible? please help me how to show that values.

$.getJSON('1.php?ID=' + <?php echo $Id; ?>, function(json) {
          $('#container').highcharts({
                chart: {
                    renderTo: 'container',
                    type: 'spline',
                    animation: Highcharts.svg,
                    marginRight: 130,
                    marginBottom: 25,
                
                },
                title: {
                    text: 'Lab',
                    x: -20 //center
                },
                subtitle: {
                    text: '',
                    x: -20
                },
                xAxis: {
                    type: 'time',
                    tickPixelInterval: 007
                },
                yAxis: {
                    title: {
                        text: 'Lab'
                    },
                    plotLines: [{
                        value: 0,
                        width: 1,
                        color: '#808080'
                    }]
                },
                
                legend: {
                    layout: 'vertical',
                    align: 'right',
                    verticalAlign: 'top',
                    x: -10,
                    y: 100,
                    borderWidth: 0
                },
                exporting: {
                    enabled: true
                },
               series: [{
                                        name: 'Lab',
                                        data: json.data,
                                        datataLabels: {
                                             enabled: true,
                                             rotation: -90,
                                             color: '#FFFFFF',
                                            align: 'right',
                                            y: 10,
                                                  style: {
                                                       fontSize: '13px',
                                                       fontFamily: 'Verdana, sans-serif',
                                                       textShadow: '0 0 3px black',

                                                        }
                                                  }
                                              }]
            });
        });

1.php have just MySQL retrial query $sth = mysql_query("SELECT DateandTime,BP FROM table WHERE ID='".$Id."'");

</div>
  • 写回答

1条回答 默认 最新

  • dongqian2021 2015-06-11 04:45
    关注

    You should be able to accomplish what I believe that you are indicating that you want by do a few things listed below.

    First, you will need to restructure your JSON packet to include labels that Highcharts can use in a series, as follows:

    var json = {
        data: [ ["100/50",(100/50)], ["100/60",(100/60)], ["100/75",(100/75)], ["100/30",(100/30)] ]
    };
    

    Then you will need to make a few adjustments to your chart js, so that you override the default tooltip by adding this block inside the highcharts config object (right after the xAxis block is a good place for it):

    xAxis: {
        //some xAxis overrides here
    },
    tooltip: {
        pointFormat: ''
    },
    

    What that does is basically tell highcharts to make the tooltip data point '', so in essence it isn't rendered but the label still shows up on your mouseovers.

    That having been done, your yAxis labels will still be decimal values representing the range steps of the fractions, so you will either want to suppress that or handle it otherwise.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 chaquopy python 安卓
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 有没有帮写代码做实验仿真的
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥30 vmware exsi重置后登不上
  • ¥15 易盾点选的cb参数怎么解啊
  • ¥15 MATLAB运行显示错误,如何解决?
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容
  • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题