本帖最后由 yhdata_NLKeTicM 于 2025-3-26 13:56 编辑
[backcolor=rgba(100, 147, 252, 0.16)]var bcol = new BCol("price", DOUBLE, false);[backcolor=rgba(100, 147, 252, 0.16)]var bcol1 = new BCol("profit", DOUBLE, false);
[backcolor=rgba(100, 147, 252, 0.16)]var a = new MeasureCol(SUM, bcol, null);
[backcolor=rgba(100, 147, 252, 0.16)]var b = new MeasureCol(SumWT, bcol, bcol1);
[backcolor=rgba(100, 147, 252, 0.16)]var c = new MeasureCol(Quartile, bcol, 4)
[backcolor=rgba(100, 147, 252, 0.16)]4.BCol,DimCol,MeasureCol场景举例
[backcolor=rgba(100, 147, 252, 0.16)]表格组件上绑定维度和度量列,并设置按列排序,Top N。
[backcolor=rgba(100, 147, 252, 0.16)]在表格(图表1)的脚本对话框中设置脚本如下:
[backcolor=rgba(100, 147, 252, 0.16)]图表1.binding.source = "咖啡中国市场销售数据.sqry"
[backcolor=rgba(100, 147, 252, 0.16)]var bcol1 = new BCol("市场级别", STRING, true);
[backcolor=rgba(100, 147, 252, 0.16)]var bcol2 = new BCol("市场分布", STRING, true);
[backcolor=rgba(100, 147, 252, 0.16)]var dcol1 = new DimCol(bcol1);
[backcolor=rgba(100, 147, 252, 0.16)]var dcol2 = new DimCol(bcol2);
[backcolor=rgba(100, 147, 252, 0.16)]var bcol3 = new BCol("销量", DOUBLE, false);
[backcolor=rgba(100, 147, 252, 0.16)]var bcol4 = new BCol("利润", DOUBLE, false);
[backcolor=rgba(100, 147, 252, 0.16)]var bcol5 = new BCol("销售额", DOUBLE, false);
[backcolor=rgba(100, 147, 252, 0.16)]var mcol1 = new MeasureCol(SUM, bcol3, null);
[backcolor=rgba(100, 147, 252, 0.16)]var mcol2 = new MeasureCol(SumWT, bcol4, bcol5);
[backcolor=rgba(100, 147, 252, 0.16)]var mcol3 = new MeasureCol(Quartile, bcol4, 4);
[backcolor=rgba(100, 147, 252, 0.16)]dcol1.sortType = 6; //市场级别上设置按列排序
[backcolor=rgba(100, 147, 252, 0.16)]dcol1.sortBy = mcol1; //按列排序列为销量_总和
[backcolor=rgba(100, 147, 252, 0.16)]dcol1.sortRank = 1; //指定Top N为1
[backcolor=rgba(100, 147, 252, 0.16)]dcol1.sortGroupOthers=true; //设置是否显示显示Top N以外的其它数据
[backcolor=rgba(100, 147, 252, 0.16)]dcol1.showTotal=true; //设置小计,默认为后置
[backcolor=rgba(100, 147, 252, 0.16)]dcol1.groupSpan=false; //设置市场级别是否合并单元格
[backcolor=rgba(100, 147, 252, 0.16)]图表1.binding.clearCols();
[backcolor=rgba(100, 147, 252, 0.16)]图表1.binding.addCol(0, dcol1);
[backcolor=rgba(100, 147, 252, 0.16)]图表1.binding.addCol(1, dcol2);
[backcolor=rgba(100, 147, 252, 0.16)]图表1.binding.addCol(2, mcol1);
[backcolor=rgba(100, 147, 252, 0.16)]图表1.binding.addCol(3, mcol2);
[backcolor=rgba(100, 147, 252, 0.16)]图表1.binding.addCol(4, mcol3);
[backcolor=rgba(100, 147, 252, 0.16)]这个是我绑定的数据
我现在只想使脚本实现求出某列数据中的最大值,最小值,后续还有峰值等计算的,有什么方法么,能否 举个例子
|