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.

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

报告相同问题?

悬赏问题

  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效