首页 \ 问答 \ 如何使用Scatter Plot highchart绘制下图?(How to draw following graph using Scatter Plot highchart?)

如何使用Scatter Plot highchart绘制下图?(How to draw following graph using Scatter Plot highchart?)

如何使用Scatter Plot highchart绘制下图? 我试图实现这种使用Highcharts在屏幕截图中显示的情节。 到现在为止,我可以使用Scatter Plot将点绘制到图表上,但是我无法从X轴和Y轴绘制这两条红线。 你们中的任何人都可以帮助我,我需要做的是从一个点绘制两条直线,一条朝向X轴,另一条朝向Y轴。 附加的代码只是我用于绘制散点图的JS代码。 谢谢 在此处输入图像描述

/* calculationChart */
$(function () {
$('#FHIchart').highcharts({
    chart: {
        type: 'scatter',
        zoomType: 'xy'
    },
    title: {
        text: 'Height Versus Weight of 507 Individuals by Gender'
    },
    subtitle: {
        text: 'Source: Heinz  2003'
    },
    xAxis: {
        title: {
            enabled: true,
            text: 'Strategic Alignment'
        },
        startOnTick: true,
        endOnTick: true,
        showLastLabel: true,
    },
    yAxis: {
        title: {
            text: 'Process & Technology Integration'
        },
    },
    legend: {
        layout: 'vertical',
        align: 'left',
        verticalAlign: 'top',
        x: 100,
        y: 70,
        floating: true,
        backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF',
        borderWidth: 1
    },
    plotOptions: {
        scatter: {
            lineWidth: 2
        }
    },
    series: [{
            name: ' ',
            color: 'Red',
            data: [[3.1, 3]]
        }]
});
});

这是我的代码。


How can i draw following graph using Scatter Plot highchart? I am trying to achieve this kind of plot that is being displayed in screenshot using Highcharts. Till now I am able to Draw point onto the chart using Scatter Plot but I am having trouble plot these two red line from X-axis and Y-axis. Can anyone of you help me here the what I need to do to draw two straight line from a point, one toward X-axis and second toward Y-axis. The attached code is only the JS code that I used for ploting the scatter graph. Thanks enter image description here

/* calculationChart */
$(function () {
$('#FHIchart').highcharts({
    chart: {
        type: 'scatter',
        zoomType: 'xy'
    },
    title: {
        text: 'Height Versus Weight of 507 Individuals by Gender'
    },
    subtitle: {
        text: 'Source: Heinz  2003'
    },
    xAxis: {
        title: {
            enabled: true,
            text: 'Strategic Alignment'
        },
        startOnTick: true,
        endOnTick: true,
        showLastLabel: true,
    },
    yAxis: {
        title: {
            text: 'Process & Technology Integration'
        },
    },
    legend: {
        layout: 'vertical',
        align: 'left',
        verticalAlign: 'top',
        x: 100,
        y: 70,
        floating: true,
        backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF',
        borderWidth: 1
    },
    plotOptions: {
        scatter: {
            lineWidth: 2
        }
    },
    series: [{
            name: ' ',
            color: 'Red',
            data: [[3.1, 3]]
        }]
});
});

here is my code.


原文:https://stackoverflow.com/questions/43641324
更新时间:2023-02-10 21:02

最满意答案

您可以使用条件标签

例如:

add_filter( 'template_include','include_template_function', 1 );

function include_template_function( $template_path ) {

    if( is_search() ) 
        $template_path = plugin_dir_path( __FILE__ ) .'/movie-searchresult_reviews.php';

    if( is_author() ) 
        $template_path = plugin_dir_path( __FILE__ ) .'/user_profile.php';


    return $template_path;
}

You can use Conditional Tags for this.

For example:

add_filter( 'template_include','include_template_function', 1 );

function include_template_function( $template_path ) {

    if( is_search() ) 
        $template_path = plugin_dir_path( __FILE__ ) .'/movie-searchresult_reviews.php';

    if( is_author() ) 
        $template_path = plugin_dir_path( __FILE__ ) .'/user_profile.php';


    return $template_path;
}

相关问答

更多