-
Notifications
You must be signed in to change notification settings - Fork 649
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
578 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"enableLegacyRemoteDebug": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
page { | ||
background: #f7f7f7; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* eslint-disable */ | ||
App({ | ||
onLaunch(_options) { | ||
// 第一次打开 | ||
// options.query == {number:1} | ||
console.info('App onLaunch'); | ||
}, | ||
onShow(_options) { | ||
// 从后台被 scheme 重新打开 | ||
// options.query == {number:1} | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"pages": [ | ||
"pages/index/index" | ||
], | ||
"window": { | ||
"defaultTitle": "My App" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"plugins": [ | ||
[ | ||
"@babel/plugin-transform-react-jsx", | ||
{ | ||
"runtime": "automatic", | ||
"importSource": "@antv/f2" | ||
} | ||
] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"scripts": { | ||
"beforeCompile": "npm run beforeCompile" | ||
}, | ||
"enableNodeModuleBabelTransform": true, | ||
"component2": true, | ||
"enableAppxNg": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"scripts": { | ||
"beforeCompile": "babel pages --out-dir pages --only **/*.jsx" | ||
}, | ||
"dependencies": { | ||
"@antv/f2": "^5.0.0", | ||
"@antv/f-my": "^1.0.0", | ||
"@babel/cli": "^7.16.0", | ||
"@babel/core": "^7.16.0", | ||
"@babel/plugin-transform-react-jsx": "^7.16.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Chart, Interval } from '@antv/f2'; | ||
import { jsx as _jsx } from "@antv/f2/jsx-runtime"; | ||
export default (props => { | ||
const { | ||
data | ||
} = props; | ||
return _jsx(Chart, { | ||
data: data, | ||
children: _jsx(Interval, { | ||
x: "genre", | ||
y: "sold", | ||
color: "genre", | ||
selection: { | ||
selectedStyle: { | ||
fillOpacity: 1 | ||
}, | ||
unSelectedStyle: { | ||
fillOpacity: 0.4 | ||
} | ||
} | ||
}) | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { Chart, Interval } from '@antv/f2'; | ||
|
||
export default (props) => { | ||
const { data } = props; | ||
return ( | ||
<Chart data={data}> | ||
<Interval | ||
x="genre" | ||
y="sold" | ||
color="genre" | ||
selection={{ | ||
selectedStyle: { | ||
fillOpacity: 1, | ||
}, | ||
unSelectedStyle: { | ||
fillOpacity: 0.4, | ||
}, | ||
}} | ||
/> | ||
</Chart> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/* required by usingComponents */ | ||
.container { | ||
width: 100%; | ||
height: 600rpx; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<view class="container"> | ||
<f-canvas onRender="onRenderChart" data="{{chartData}}"></f-canvas> | ||
</view> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// 通过 createElement 方式创建 | ||
// import { createElement } from '@antv/f2'; | ||
import Chart from './chart'; | ||
|
||
/* eslint-disable */ | ||
import { jsx as _jsx } from "@antv/f2/jsx-runtime"; | ||
const data1 = [{ | ||
genre: 'Sports', | ||
sold: 275 | ||
}, { | ||
genre: 'Strategy', | ||
sold: 115 | ||
}, { | ||
genre: 'Action', | ||
sold: 120 | ||
}, { | ||
genre: 'Shooter', | ||
sold: 350 | ||
}, { | ||
genre: 'Other', | ||
sold: 150 | ||
}]; | ||
const data2 = [{ | ||
genre: 'Sports', | ||
sold: 275 | ||
}, { | ||
genre: 'Strategy', | ||
sold: 115 | ||
}, { | ||
genre: 'Action', | ||
sold: 20 | ||
}, { | ||
genre: 'Shooter', | ||
sold: 50 | ||
}, { | ||
genre: 'Other', | ||
sold: 50 | ||
}]; | ||
var isAppX2CanvasEnv = function isAppX2CanvasEnv() { | ||
return my.canIUse('canvas.onReady') && my.canIUse('createSelectorQuery.return.node'); | ||
}; | ||
Page({ | ||
data: { | ||
// chartData: data1, | ||
}, | ||
onReady() { | ||
this.setData({ | ||
chartData: data1 | ||
}); | ||
// 模拟数据更新 | ||
setTimeout(() => { | ||
this.setData({ | ||
chartData: data2 | ||
}); | ||
}, 2000); | ||
}, | ||
onRenderChart(props) { | ||
console.log('isAppX2CanvasEnv', isAppX2CanvasEnv()); | ||
const { | ||
data | ||
} = props; | ||
return _jsx(Chart, { | ||
data: data | ||
}); | ||
|
||
// 如果不使用 jsx, 用下面代码效果也是一样的 | ||
// return createElement(Chart, { | ||
// data: data, | ||
// }); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"usingComponents": { | ||
"f-canvas": "@antv/f-my" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// 通过 createElement 方式创建 | ||
// import { createElement } from '@antv/f2'; | ||
import Chart from './chart'; | ||
|
||
/* eslint-disable */ | ||
|
||
const data1 = [ | ||
{ genre: 'Sports', sold: 275 }, | ||
{ genre: 'Strategy', sold: 115 }, | ||
{ genre: 'Action', sold: 120 }, | ||
{ genre: 'Shooter', sold: 350 }, | ||
{ genre: 'Other', sold: 150 }, | ||
]; | ||
|
||
const data2 = [ | ||
{ genre: 'Sports', sold: 275 }, | ||
{ genre: 'Strategy', sold: 115 }, | ||
{ genre: 'Action', sold: 20 }, | ||
{ genre: 'Shooter', sold: 50 }, | ||
{ genre: 'Other', sold: 50 }, | ||
]; | ||
|
||
var isAppX2CanvasEnv = function isAppX2CanvasEnv() { | ||
return my.canIUse('canvas.onReady') && my.canIUse('createSelectorQuery.return.node'); | ||
}; | ||
|
||
Page({ | ||
data: { | ||
// chartData: data1, | ||
}, | ||
onReady() { | ||
this.setData({ | ||
chartData: data1, | ||
}); | ||
// 模拟数据更新 | ||
setTimeout(() => { | ||
this.setData({ | ||
chartData: data2, | ||
}); | ||
}, 2000); | ||
}, | ||
onRenderChart(props) { | ||
console.log('isAppX2CanvasEnv', isAppX2CanvasEnv()); | ||
const { data } = props; | ||
return <Chart data={data} />; | ||
|
||
// 如果不使用 jsx, 用下面代码效果也是一样的 | ||
// return createElement(Chart, { | ||
// data: data, | ||
// }); | ||
}, | ||
}); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "@antv/f2-my", | ||
"private": true, | ||
"version": "5.0.0", | ||
"homepage": "https://github.com/antvis/f2", | ||
"bugs": { | ||
"url": "https://github.com/antvis/f2/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/antvis/f2" | ||
}, | ||
"author": "https://github.com/orgs/antvis/people" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// app.js | ||
/* eslint-disable */ | ||
App({ | ||
onLaunch() { | ||
// 展示本地存储能力 | ||
const logs = wx.getStorageSync('logs') || []; | ||
logs.unshift(Date.now()); | ||
wx.setStorageSync('logs', logs); | ||
|
||
// 登录 | ||
wx.login({ | ||
success: () => { | ||
// 发送 res.code 到后台换取 openId, sessionKey, unionId | ||
}, | ||
}); | ||
}, | ||
globalData: { | ||
userInfo: null, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"pages":[ | ||
"pages/index/index" | ||
], | ||
"window":{ | ||
"backgroundTextStyle":"light", | ||
"navigationBarBackgroundColor": "#fff", | ||
"navigationBarTitleText": "Weixin", | ||
"navigationBarTextStyle":"black" | ||
}, | ||
"style": "v2", | ||
"sitemapLocation": "sitemap.json" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/**app.wxss**/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"plugins": [ | ||
[ | ||
"@babel/plugin-transform-react-jsx", | ||
{ | ||
"runtime": "automatic", | ||
"importSource": "@antv/f-engine" | ||
} | ||
] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"scripts": { | ||
"beforeCompile": "babel pages --out-dir pages --only **/*.jsx" | ||
}, | ||
"dependencies": { | ||
"@antv/f2": "^5.0.0", | ||
"@antv/f-wx": "^1.0.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "^7.16.0", | ||
"@babel/core": "^7.16.0", | ||
"@babel/plugin-transform-react-jsx": "^7.16.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { Chart, Interval, Axis, Legend, Tooltip } from '@antv/f2'; | ||
import { jsx as _jsx } from "@antv/f-engine/jsx-runtime"; | ||
import { jsxs as _jsxs } from "@antv/f-engine/jsx-runtime"; | ||
export default (props => { | ||
const { | ||
data | ||
} = props; | ||
return _jsxs(Chart, { | ||
data: data, | ||
children: [_jsx(Axis, { | ||
field: "genre" | ||
}), _jsx(Axis, { | ||
field: "sold" | ||
}), _jsx(Interval, { | ||
x: "genre", | ||
y: "sold", | ||
color: "genre", | ||
selection: { | ||
selectedStyle: { | ||
fillOpacity: 1 | ||
}, | ||
unSelectedStyle: { | ||
fillOpacity: 0.4 | ||
} | ||
} | ||
}), _jsx(Legend, {}), _jsx(Tooltip, {})] | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { Chart, Interval, Axis, Legend, Tooltip } from '@antv/f2'; | ||
|
||
export default (props) => { | ||
const { data } = props; | ||
return ( | ||
<Chart data={data}> | ||
<Axis field="genre" /> | ||
<Axis field="sold" /> | ||
<Interval | ||
x="genre" | ||
y="sold" | ||
color="genre" | ||
selection={{ | ||
selectedStyle: { | ||
fillOpacity: 1, | ||
}, | ||
unSelectedStyle: { | ||
fillOpacity: 0.4, | ||
}, | ||
}} | ||
/> | ||
<Legend /> | ||
<Tooltip /> | ||
</Chart> | ||
); | ||
}; |
Oops, something went wrong.