Skip to content
New issue

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

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

Already on GitHub? # to your account

feat: add draw background for sequence-scatter #3787

Open
wants to merge 2 commits into
base: feat/sequence-scatter
Choose a base branch
from

Conversation

Mildclimate
Copy link

[中文版模板 / Chinese template]

🤔 This is a ...

  • New feature
  • Bug fix
  • TypeScript definition update
  • Bundle size optimization
  • Performance optimization
  • Enhancement feature
  • Refactoring
  • Update dependency
  • Code style optimization
  • Test Case
  • Branch merge
  • Release
  • Site / documentation update
  • Demo update
  • Workflow
  • Other (about what?)

🔗 Related issue link

🔗 Related PR link

🐞 Bugserver case id

💡 Background and solution

📝 Changelog

Language Changelog
🇺🇸 English
🇨🇳 Chinese

☑️ Self-Check before Merge

⚠️ Please check all items below before requesting a reviewing. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

🚀 Summary

copilot:summary

🔍 Walkthrough

copilot:walkthrough


// 创建Canvas离屏渲染
const canvas = document.createElement('canvas');
canvas.width = 300;
Copy link
Contributor

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
Copy link
Contributor

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;
Copy link
Contributor

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);
Copy link
Contributor

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) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

写成工具函数放在utils.ts中

Copy link
Author

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';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

写成常量放在constant.ts中

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get

@Mildclimate
Copy link
Author

fixed them

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants