3

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."'");

11
  • I believe they dynamically assign these values and creates those ranges dynamically so its essentially gonna be floats/ints instead of string. Still if want want to change you'll have to dig into its source files May 22, 2015 at 9:34
  • Do you mean that labels on yAxis should have these "names", or data should be ranged? May 22, 2015 at 9:35
  • Data range @SebastianBochan
    – Mild Milly
    May 22, 2015 at 10:38
  • i put my values dynamically get from database. i cant able to access that fraction values . only i can access int and float values @ɢʜʘʂʈʀɛɔʘɴ
    – Mild Milly
    May 22, 2015 at 10:40
  • How your data looks like ? May 25, 2015 at 8:35

1 Answer 1

1

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.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.