Open
Description
String[] colorsArr = {
"#73DDFF",
"#9E87FF",
"#aecb56",
"#fe9a8b",
"#F56948",
"#9E87FF",
"#00ffa2",
"#0092f6",
"#00d4c7",
"#aecb56",
"#3A44FB",
"#6FE81A",
};
AAChartModel aaChartModel = new AAChartModel()
.legendEnabled(true)//是否显示图例
.stacking(AAChartStackingType.Normal)
.colorsTheme(colorsArr);
/*Custom Tooltip Style --- 自定义图表浮动提示框样式及内容*/
AAOptions aaOptions = AAOptionsConstructor.configureChartOptions(aaChartModel);
AATitle aaTitle = new AATitle()
.text("");
AASubtitle aaSubtitle = new AASubtitle()
.text("首次报名年龄段情况")
.style(new AAStyle()
.color("#333")
.fontSize(14f)
.fontWeight("bold"))
.align("left");
AAXAxis aaXAxis = new AAXAxis()
.lineWidth(0f)
.visible(true)
.min(0f)
.labels(new AALabels()
.useHTML(true)
.style(new AAStyle()
.fontSize(15.f)
.fontWeight("400")
.color("#333")//轴文字颜色
))
.categories(new String[]{"一月", "二月", "三月", "四月", "五月", "六月"});
AAYAxis yAxis1 = new AAYAxis()
.visible(true)
.max(100)
.min(0)
.gridLineWidth(0f)
.labels(new AALabels()
.enabled(true)//设置 y 轴是否显示数字
.format("{value}%")
.style(new AAStyle()
.color("#333333")//yAxis Label font color
))
.title(new AATitle()
.text("")
.style(new AAStyle()
.color("#333333")));
AAYAxis yAxis2 = new AAYAxis()
.visible(true)
.gridLineWidth(0f)
.labels(new AALabels()
.enabled(true)//设置 y 轴是否显示数字
.format("{value}")
.style(new AAStyle()
.color("#333333")//yAxis Label font color
))
.offset(0)
.title(new AATitle()
.align("high")
.y(-10)
.text("人数(人)")
.style(new AAStyle()
.color("#333333")))
.opposite(true);
AATooltip aaTooltip = new AATooltip()
.enabled(true)
.shared(true);
AALegend aaLegend = new AALegend()
.enabled(true)
.floating(true)
.layout(AAChartLayoutType.Horizontal)
.align(AAChartAlignType.Center)
.x(80f)
.verticalAlign(AAChartVerticalAlignType.Top)
.y(0f);
AASeriesElement[] aaSeriesArr = {
new AASeriesElement()
.name("新用户")
.type(AAChartType.Column)
.yAxis(0)
.data(new Object[]{20, 30, 20, 30, 20, 30})
.tooltip(new AATooltip()
.valueSuffix(" %")
)
.dataLabels(
new AADataLabels()
.enabled(true)
.format("{y:.2f}%")
.style(new AAStyle()
.color("#000000")
.fontSize(12f)
)
)
,
new AASeriesElement()
.name("老用户")
.type(AAChartType.Column)
.yAxis(0)
.data(new Object[]{20, 30, 20, 30, 20, 30})
.tooltip(new AATooltip()
.valueSuffix(" %")
)
.dataLabels(
new AADataLabels()
.enabled(true)
.format("{y:.2f}%")
.style(new AAStyle()
.color("#000000")
.fontSize(12f)
)
),
new AASeriesElement()
.name("总量")
.type(AAChartType.Column)
.yAxis(0)
.data(new Object[]{60, 40, 60, 40, 60, 40})
.tooltip(new AATooltip()
.valueSuffix(" %")
)
.dataLabels(
new AADataLabels()
.enabled(true)
.format("{y:.2f}%")
.style(new AAStyle()
.color("#000000")
.fontSize(12f)
)
),
new AASeriesElement()
.name("海平面气压")
.type(AAChartType.Line)
.yAxis(1)
.data(new Object[]{23, 333, 3333, 22, 333.3, 666})
// .dashStyle(AAChartLineDashStyleType.ShortDot)
.tooltip(new AATooltip()
.valueSuffix(" 人")),
new AASeriesElement()
.name("温度")
.type(AAChartType.Line)
.yAxis(1)
.data(new Object[]{11, 77, 999, 4444, 18.2, 444})
.tooltip(new AATooltip()
.valueSuffix(" 人"))
};
aaOptions
.title(aaTitle)
.subtitle(aaSubtitle)
.colors(colorsArr)
.xAxis(aaXAxis)
.yAxisArray(new AAYAxis[]{yAxis1, yAxis2})
.tooltip(aaTooltip)
.legend(aaLegend)
.series(aaSeriesArr);
return aaOptions;
Metadata
Metadata
Assignees
Labels
No labels