0

been trying to enable crosshairs on highcharts.... on jsfindle the example works fine, but when i put it into my web page it just won't work, can you please check the code? Thanks

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<script type="text/javascript" src="./js/highcharts.js"></script>
<script type="text/javascript">
var chart;
$(document).ready(function() {
chart = new Highcharts.Chart({
  chart: {
     renderTo: 'chartcontainer'
  },

  tooltip: {
      crosshairs: [true,true],
      shared: true,
      enabled: true
  },

  plotOptions: {
      series: {
            marker: {
                enabled: false
            }
        }
    },

  series: [{
      data: [[3809.6, 1.1], [3823.26, 1.27], [3836.91, 1.4], [3850.57, 1.48], [3864.22,        1.56], [3877.88, 1.71], [3891.53, 1.92], [3905.19, 2.07], [3918.84, 2.09], [3932.49, 2.02], [3946.15, 1.99], [3959.8, 2.04], [3973.46, 2.16], [3987.11, 2.29], [4000.77, 2.38], [4014.42, 2.41], [4028.08, 2.39], [4041.73, 2.35], [4055.38, 2.26], [4069.04, 2.14], [4082.69, 2.06], [4096.35, 2.04], [4110, 2.1], [4123.66, 2.19], [4137.31, 2.26], [4150.97, 2.28], [4164.62, 2.29], [4178.28, 2.28], [4191.93, 2.27], [4205.58, 2.25], [4219.24, 2.23], [4232.89, 2.2], [4246.55, 2.18], [4260.2, 2.16], [4273.86, 2.13], [4287.51, 2.09], [4301.17, 2.02], [4314.82, 1.94], [4328.47, 1.89], [4342.13, 1.86], [4355.78, 1.88], [4369.44, 1.91], [4383.09, 1.94], [4396.75, 1.94], [4410.4, 1.94], [4424.06, 1.93], [4437.71, 1.91], [4451.37, 1.9], [4465.02, 1.88], [4478.67, 1.87], [4492.33, 1.85], [4505.98, 1.83], [4519.64, 1.82], [4533.29, 1.8], [4546.95, 1.79], [4560.6, 1.77], [4574.26, 1.75], [4587.91, 1.74], [4601.56, 1.73], [4615.22, 1.71], [4628.87, 1.7], [4642.53, 1.69], [4656.18, 1.67], [4669.84, 1.66], [4683.49, 1.65], [4697.15, 1.63], [4710.8, 1.62], [4724.46, 1.61], [4738.11, 1.59], [4751.76, 1.58], [4765.42, 1.56], [4779.07, 1.54], [4792.73, 1.52], [4806.38, 1.49], [4820.04, 1.46], [4833.69, 1.43], [4847.35, 1.4], [4861, 1.38], [4874.65, 1.37], [4888.31, 1.38], [4901.96, 1.38], [4915.62, 1.38], [4929.27, 1.38], [4942.93, 1.38], [4956.58, 1.37], [4970.24, 1.36], [4983.89, 1.35], [4997.54, 1.34], [5011.2, 1.33], [5024.85, 1.32], [5038.51, 1.31], [5052.16, 1.3], [5065.82, 1.3], [5079.47, 1.29], [5093.13, 1.28], [5106.78, 1.27], [5120.44, 1.26], [5134.09, 1.25], [5147.74, 1.24], [5161.4, 1.23], [5175.05, 1.21], [5188.71, 1.2], [5202.36, 1.19], [5216.02, 1.18], [5229.67, 1.18], [5243.33, 1.17], [5256.98, 1.16], [5270.63, 1.15], [5284.29, 1.15], [5297.94, 1.14], [5311.6, 1.13], [5325.25, 1.12], [5338.91, 1.11], [5352.56, 1.11], [5366.22, 1.1], [5379.87, 1.09], [5393.53, 1.08], [5407.18, 1.07], [5420.83, 1.06], [5434.49, 1.05], [5448.14, 1.04], [5461.8, 1.03], [5475.45, 1.03], [5489.11, 1.02], [5502.76, 1.01], [5516.42, 1], [5530.07, 1], [5543.72, 0.99], [5557.38, 0.98], [5571.03, 0.98], [5584.69, 0.97], [5598.34, 0.97], [5612, 0.96], [5625.65, 0.95], [5639.31, 0.95], [5652.96, 0.94], [5666.62, 0.93], [5680.27, 0.93], [5693.92, 0.92], [5707.58, 0.91], [5721.23, 0.91], [5734.89, 0.9], [5748.54, 0.89], [5762.2, 0.89], [5775.85, 0.88], [5789.51, 0.88], [5803.16, 0.87], [5816.81, 0.87], [5830.47, 0.86], [5844.12, 0.85], [5857.78, 0.85], [5871.43, 0.84], [5885.09, 0.84], [5898.74, 0.83], [5912.4, 0.83], [5926.05, 0.82], [5939.71, 0.82], [5953.36, 0.81], [5967.01, 0.81], [5980.67, 0.8], [5994.32, 0.8], [6007.98, 0.8], [6021.63, 0.79], [6035.29, 0.79], [6048.94, 0.79], [6062.6, 0.78], [6076.25, 0.78], [6089.9, 0.77], [6103.56, 0.77], [6117.21, 0.76], [6130.87, 0.76], [6144.52, 0.75], [6158.18, 0.75], [6171.83, 0.75], [6185.49, 0.74], [6199.14, 0.74], [6212.79, 0.73], [6226.45, 0.73], [6240.1, 0.72], [6253.76, 0.72], [6267.41, 0.72], [6281.07, 0.72], [6294.72, 0.71], [6308.38, 0.71], [6322.03, 0.71], [6335.69, 0.7], [6349.34, 0.7], [6362.99, 0.7], [6376.65, 0.7], [6390.3, 0.69], [6403.96, 0.69], [6417.61, 0.68], [6431.27, 0.68], [6444.92, 0.67], [6458.58, 0.67], [6472.23, 0.66], [6485.88, 0.65], [6499.54, 0.64], [6513.19, 0.63], [6526.85, 0.62], [6540.5, 0.62], [6554.16, 0.61], [6567.81, 0.61], [6581.47, 0.61], [6595.12, 0.6], [6608.78, 0.61], [6622.43, 0.61], [6636.08, 0.61], [6649.74, 0.61], [6663.39, 0.62], [6677.05, 0.62], [6690.7, 0.62], [6704.36, 0.62], [6718.01, 0.62], [6731.67, 0.61], [6745.32, 0.61], [6758.97, 0.61], [6772.63, 0.6], [6786.28, 0.6], [6799.94, 0.59], [6813.59, 0.58], [6827.25, 0.57], [6840.9, 0.57], [6854.56, 0.56], [6868.21, 0.56], [6881.87, 0.55], [6895.52, 0.54], [6909.17, 0.54], [6922.83, 0.53], [6936.48, 0.53], [6950.14, 0.53], [6963.79, 0.54], [6977.45, 0.54], [6991.1, 0.54], [7004.76, 0.54], [7018.41, 0.54], [7032.06, 0.53], [7045.72, 0.53], [7059.37, 0.52], [7073.03, 0.52], [7086.68, 0.51], [7100.34, 0.51], [7113.99, 0.5], [7127.65, 0.49], [7141.3, 0.48], [7154.96, 0.48], [7168.61, 0.47], [7182.26, 0.46], [7195.92, 0.45], [7209.57, 0.44], [7223.23, 0.44], [7236.88, 0.43], [7250.54, 0.43], [7264.19, 0.42], [7277.85, 0.42], [7291.5, 0.42], [7305.15, 0.41], [7318.81, 0.41], [7332.46, 0.41], [7346.12, 0.41], [7359.77, 0.4], [7373.43, 0.4], [7387.08, 0.4], [7400.74, 0.39], [7414.39, 0.39], [7428.04, 0.39], [7441.7, 0.39], [7455.35, 0.39], [7469.01, 0.39], [7482.66, 0.39], [7496.32, 0.38], [7509.97, 0.38], [7523.63, 0.36], [7537.28, 0.34], [7550.94, 0.32], [7564.59, 0.3], [7578.24, 0.29], [7591.9, 0.29], [7605.55, 0.28], [7619.21, 0.29], [7632.86, 0.29], [7646.52, 0.29], [7660.17, 0.3], [7673.83, 0.3], [7687.48, 0.31], [7701.13, 0.32], [7714.79, 0.32], [7728.44, 0.34], [7742.1, 0.35], [7755.75, 0.37], [7769.41, 0.38], [7783.06, 0.39], [7796.72, 0.39], [7810.37, 0.4], [7824.03, 0.4], [7837.68, 0.4], [7851.33, 0.39], [7864.99, 0.39], [7878.64, 0.38], [7892.3, 0.38], [7905.95, 0.38], [7919.61, 0.38], [7933.26, 0.39], [7946.92, 0.39], [7960.57, 0.4], [7974.22, 0.4]   ]   
  }]
 });   
});
</script>

<div id="chartcontainer"></div>

The result i get is the chart with the line, but on mouseover the crosshair doesn't show. Thanks

1 Answer 1

1

It's not clear to me: is this the entire code of your page, or have you extracted doctype, html, head, and body tags for the sake of simplicity?

Do the crosshairs work for you in this jsbin example? They do for me. http://jsbin.com/aworob/edit#javascript,html,live

Also, it may be to your advantage and your end users to place your javascript src tags and your inline script at the bottom of the page, just above the closing </body> tag. If you did this, remove the $(document).ready(function() { wrapper. Read more at: http://developer.yahoo.com/performance/rules.html#js_bottom

1
  • must be the highcharts.js file i was using (though i downloaded last version). If i call the highcharts.com/test it works perfect. Many thanks Dec 10, 2011 at 1:45

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.