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

请问这种金字塔类型的图表要怎么做? #74

Open
arieslee opened this issue Apr 24, 2024 · 4 comments
Open

请问这种金字塔类型的图表要怎么做? #74

arieslee opened this issue Apr 24, 2024 · 4 comments

Comments

@arieslee
Copy link

arieslee commented Apr 24, 2024

如图:
image

我试了下,把itemsMan设置为正数,itemsWoman设置为负数,出来的结果不对,是下面这种效果
image

	itemsMan := make([]float64, 0)
	itemsWoman := make([]float64, 0)

	for _, v := range dbData.Series {
		if v.Name == "男士" {
			for _, d := range v.Data {
				itemsMan = append(itemsMan, float64(d))
			}
		} else {
			for _, d := range v.Data {
				itemsWoman = append(itemsWoman, float64(d))
			}
		}
	}
	imgName := fmt.Sprintf("./tmps/people_pyramid%d_%s.png", year, areaCode)
	values := [][]float64{
		itemsMan, itemsWoman,
	}
@vicanso
Copy link
Owner

vicanso commented Apr 24, 2024

很抱歉,暂时无法支持

@arieslee
Copy link
Author

arieslee commented Apr 24, 2024

很抱歉,暂时无法支持

哎呀,可惜了

但是#29 这个issues里面我看是可以支持负数的呀,这个怎么实现的呢?

@arieslee arieslee reopened this Apr 24, 2024
@vicanso
Copy link
Owner

vicanso commented Apr 30, 2024

你这个图主要是左右是两组数据的展示,而不是负数的问题吧

@vicanso
Copy link
Owner

vicanso commented Apr 30, 2024

如果不是一定要用go语言,可以考虑使用:https://github.com/vicanso/charts-rs ,该项目提供了http接口的形式来生成图表:https://github.com/vicanso/charts-rs-web

演示地址:https://charts.npmtrend.com/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants