-
Notifications
You must be signed in to change notification settings - Fork 153
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
feat: add draw background for sequence-scatter #3787
base: feat/sequence-scatter
Are you sure you want to change the base?
feat: add draw background for sequence-scatter #3787
Conversation
|
||
// 创建Canvas离屏渲染 | ||
const canvas = document.createElement('canvas'); | ||
canvas.width = 300; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
配置从spec中读取,spec.width / spec.height
function createImageDataFromColorMatrix(colorMatrix: any[][]): string | null { | ||
// 浏览器环境检查 | ||
if (typeof document === 'undefined') { | ||
return null; // 非浏览器环境下返回null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
抛出error('.....')
const ctx = canvas.getContext('2d'); | ||
|
||
if (!ctx) { | ||
return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同上,抛出error
} | ||
|
||
// 创建imageData | ||
const imageData = ctx.createImageData(300, 300); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同上,width和height从spec中读取
@@ -93,7 +111,14 @@ export class SequenceScatterChartSpecTransformer extends CommonChartSpecTransfor | |||
|
|||
export function processSequenceData(spec: ISequenceScatterSpec) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
写成工具函数放在utils.ts中
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok get
@@ -93,7 +111,14 @@ export class SequenceScatterChartSpecTransformer extends CommonChartSpecTransfor | |||
|
|||
export function processSequenceData(spec: ISequenceScatterSpec) { | |||
const result: any[] = []; | |||
const BACKGROUND_KEY = 'background'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
写成常量放在constant.ts中
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get
fixed them |
[中文版模板 / Chinese template]
🤔 This is a ...
🔗 Related issue link
🔗 Related PR link
🐞 Bugserver case id
💡 Background and solution
📝 Changelog
☑️ Self-Check before Merge
🚀 Summary
copilot:summary
🔍 Walkthrough
copilot:walkthrough