zengqinn123 2020-01-01 19:46 采纳率: 0%
浏览 261

Java 如何配置echart 的 option的多个grid

Java如果调用echart的API配置同一个option里设置多个grid
像这样 grid: [
        {x: '5%', y: '5%', width: '40%', height: '16%'},
        {x: '60%', y: '5%', width: '40%', height: '16%'},
        {x: '5%', y: '35%', width: '40%', height: '16%'},
        {x: '60%', y: '35%', width: '40%', height: '16%'},
       {x: '5%', y: '85%', width: '40%', height: '16%'},
        {x: '60%', y: '85%', width: '40%', height: '16%'}
    ],

    如果设置多个option.grid()方法则会覆盖之前的,如果设置多个x,y的值也是会覆盖之前的,不知道怎么设置,求救
  • 写回答

1条回答

  • Raydono 2023-11-28 16:00
    关注
    
    import org.json.JSONArray;
    import org.json.JSONObject;
    
    public class Main {
        public static void main(String[] args) {
            JSONObject option = new JSONObject();
            JSONArray gridArray = new JSONArray();
    
            JSONObject grid1 = new JSONObject();
            grid1.put("x", "5%");
            grid1.put("y", "5%");
            grid1.put("width", "40%");
            grid1.put("height", "16%");
            gridArray.put(grid1);
    
            JSONObject grid2 = new JSONObject();
            grid2.put("x", "60%");
            grid2.put("y", "5%");
            grid2.put("width", "40%");
            grid2.put("height", "16%");
            gridArray.put(grid2);
    
            // 添加更多的grid...
    
            option.put("grid", gridArray);
    
            System.out.println(option.toString());
        }
    }
    
    
    评论

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料