首页 > 解决方案 > Highcharts.net 包装器中的 highcharts 响应方法

问题描述

我想知道这个 JavaScript 代码的 ASP.net 包装器实现

responsive: {

    rules
        rules: [{
            condition: {
                maxWidth: 370
            },
            chartOptions: {
                chart: {
                    width: 250,
                    height: 400,
                    marginLeft: 40,
                    marginTop:-120
                },
                legend: {
                    x: -20,
                    y: 260,
                    floating: true,
                    align: 'left',
                    verticalAlign: 'top',
                    layout: 'horizontal',
                    width: 300
                }
            }
    }]
}

我以这种方式尝试过,但没有为 Condition 和 ChartOptions 获得正确的命名空间

Responsive = new Responsive()
{
    Rules= new List<ResponsiveRules>{
    Condition = new ResponsiveRulesCondition()
    {
        MaxWidth = 375
    },
    ChartOptions
    {
    }
}

标签: highchartsresponsive

解决方案


chartOptionsobject类型

Responsive responsive = new Responsive()
            {
                Rules = new List<Highsoft.Web.Mvc.Charts.ResponsiveRules>()
                {
                    new Highsoft.Web.Mvc.Charts.ResponsiveRules
                    {
                        ChartOptions = new { chart = new { className = "small-chart" } },
                        Condition = new ResponsiveRulesCondition() { MaxWidth = 500 }
                    }
                }
            };

推荐阅读