Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🤔 图表只渲染了表头信息,具体内容值信息没渲染? #2859

Closed
stone1314 opened this issue Aug 13, 2024 · 2 comments
Closed
Labels
❔question 疑问/使用问题

Comments

@stone1314
Copy link

🏷 Version

使用:
@antv/s2-react | 1.18.0

antd 3.15.2

react 16.12.0

表单类型: StrategySheet

接口请求结果,放入组件中,左列信息和头行信息都有,但是具体数值信息没有,是版本问题吗?我直接写死数据是能正常显示。如图
WX20240813-172343

`
import React,{useState,useRef} from 'react';
import { connect } from 'umi';
import { useFetchData } from 'be-pms-plus';
import { SheetComponent, SheetComponentOptions} from '@antv/s2-react';
import type { S2DataConfig } from '@antv/s2';
import { Form } from 'antd';
import { getFlSaleStaReport } from '@/services/report.ts';
import '@antv/s2-react/dist/style.min.css';
import './style.less'

export const Xstjrb:React.FC=(props:any) => {
const s2Ref = useRef(null);
const [params,setParams]=useState({});
const [data] = useFetchData(
() => getFlSaleStaReport({
apartmentIdList: [2],
queryTime: "2024-07-24"
}),
[],
[params],
);

const s2Options: SheetComponentOptions = {
    width: 2100,
    height: 880,
    cornerText: '指标层级', 
    hierarchyType: 'customTree', 
  style: {
    cellCfg: {
        width:10,
      valuesCfg: {
        // 非必填: 指定原始字段, 用于 导出和 tooltip 展示
        originalValueField: 'originalValues',
        // 非必填: 是否显示原始值
        showOriginalValue: true,
      },
    }, 
  },
}; 

const sheetData:S2DataConfig=data;
return (


<SheetComponent
ref={s2Ref}
// dataCfg={val4}
dataCfg={sheetData}
options={s2Options}
sheetType="strategy"
/>
)
};

export default connect(({ global }) => ({
apartments: global.apartments,
permissionList: global.permissionList,
}))(Xstjrb);

`

麻烦看下,谢谢!

@stone1314 stone1314 added the ❔question 疑问/使用问题 label Aug 13, 2024
@stone1314
Copy link
Author

刚试了 antd 4.24.16,s2/react: 1.47.0 react 16.13.1 也是这样 囧?

@stone1314 stone1314 changed the title 🤔 非最新版本是我代码问题吗? 🤔 图表只渲染了表头信息,具体内容值信息没渲染? Aug 14, 2024
@stone1314
Copy link
Author

需要赋初始值: {
"data": [],
"meta": [],
"fields": {}
}
否则,不能渲染具体内容值信息

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
❔question 疑问/使用问题
Projects
None yet
Development

No branches or pull requests

1 participant