Amcharts 时间线修改
Amcharts timeline modifications
我想更改项目符号中的图像以使时间线变圆。
我正在尝试用 css 覆盖 css!重要和 jquery。但我无法更改子弹内的图像
看看我的codepen
https://codepen.io/levicosta201/pen/RwwQJXV
<div id="chartdiv" style="height: 500px !important;"></div>
<script src="https://www.amcharts.com/lib/4/core.js"></script>
<script src="https://www.amcharts.com/lib/4/charts.js"></script>
<script src="https://www.amcharts.com/lib/4/themes/material.js"></script>
<script src="https://www.amcharts.com/lib/4/themes/animated.js"></script>
<script src="https://www.amcharts.com/lib/4/plugins/timeline.js"></script>
<script src="https://www.amcharts.com/lib/4/plugins/bullets.js"></script>
<script>
//Chart IoTs sequence
am4core.ready(function() {
// Themes begin
am4core.useTheme(am4themes_animated);
// Themes end
am4core.ready(function() {
var chart = am4core.create("chartdiv", am4plugins_timeline.CurveChart);
chart.curveContainer.padding(100, 20, 50, 20);
chart.maskBullets = false;
var colorSet = new am4core.ColorSet();
chart.dateFormatter.inputDateFormat = "yyyy-MM-dd HH:mm";
chart.dateFormatter.dateFormat = "HH";
const iotIcon = "data:image/png;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4TIiaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLwA8P3hwYWNrZXQgYmVnaW49Iu+7vyIgaWQ9Ilc1TTBNcENlaGlIenJlU3pOVGN6a2M5ZCI/Pgo8eDp4bXBtZXRhIHhtbG5zOng9ImFkb2JlOm5zOm1ldGEvIiB4OnhtcHRrPSJBZG9iZSBYTVAgQ29yZSA1LjMtYzAxMSA2Ni4xNDU2NjEsIDIwMTIvMDIvMDYtMTQ6NTY6MjcgICAgICAgICI+CiAgIDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+CiAgICAgIDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiCiAgICAgICAgICAgIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyI+CiAgICAgICAgIDx4bXA6Q3JlYXRvclRvb2w+QWRvYmUgRmlyZXdvcmtzIENTNiAoV2luZG93cyk8L3htcDpDcmVhdG9yVG9vbD4KICAgICAgICAgPHhtcDpDcmVhdGVEYXRlPjIwMTktMDgtMTdUMTk6NTM6MzFaPC94bXA6Q3JlYXRlRGF0ZT4KICAgICAgICAgPHhtcDpNb2RpZnlEYXRlPjIwMTktMDgtMTdUMTk6NTM6NDNaPC94bXA6TW9kaWZ5RGF0ZT4KICAgICAgPC9yZGY6RGVzY3JpcHRpb24+CiAgICAgIDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiCiAgICAgICAgICAgIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAKPD94cGFja2V0IGVuZD0idyI/Pv/bAEMABwQEBAUEBwUFBwoHBQcKDAkHBwkMDQsLDAsLDRENDQ0NDQ0RDQ8QERAPDRQUFhYUFB4dHR0eIiIiIiIiIiIiIv/bAEMBCAcHDQwNGBAQGBoVERUaICAgICAgICAgICAgICEgICAgICAhISEgICAhISEhISEhISIiIiIiIiIiIiIiIiIiIv/AABEIAMwAzAMBEQACEQEDEQH/xAAcAAEAAgMBAQEAAAAAAAAAAAAAAQIEBQYDBwj/xABGEAABAwIDAwcIBQsDBQAAAAAAAQIDBAUREjEGIUEHEyJRYXGRFDJCcoGhsdEjJDNSwRU0NUNTYnOCkrLhNsLSZJO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ugEgAAACjtQIAAAAGPWWu31ifWYWydqpv8QNNVbB2yRcaeSSF3V56fP3gayo2CubMVgkjlTwX5Aa+bZe+w60rlw4twd8AMSa13JqKj6aVP5HfIDWrSVbVwWJ/goBKWqdpE9fYoHrHabrJ5lLM7+RQMuHZLaOdUy0b2+vgz+7ADZUvJveZPt5I4U71cvu+YG4ouTe1RYOqpXzr1Jg1PcBvaCzWug/NKdka9eG/xXeBlAAAAC7dAJAAAAFHagQAAAAAAAAAAAAAAAAAAAAAAAu3QCQAAABR2oEAAAAAAAAAAAAAAAAAAAAAAALt0AkAB/9k=";
chart.data = [{
"category": "Aiknow - Entrance",
"start": "2019-08-30 12:05",
"end": "2019-08-30 16:25",
"color": "#F60",
"icon": iotIcon,
"text": "Aiknow - Entrance"
},
{
"category": "Aiknow - Entrance",
"start": "2019-08-30 16:25",
"end": "2019-08-30 19:40",
"color": "#F00",
"icon": iotIcon,
"text": "Aiknow - Entrance"
},
{
"category": "Aiknow - Entrance",
"start": "2019-08-30 19:40",
"end": "2019-08-30 19:43",
"color": "#690310",
"icon": iotIcon,
"text": "Aiknow - Entrance"
}
];
chart.fontSize = 10;
chart.tooltipContainer.fontSize = 10;
var categoryAxis = chart.yAxes.push(new am4charts.CategoryAxis());
categoryAxis.dataFields.category = "category";
categoryAxis.renderer.grid.template.disabled = true;
categoryAxis.renderer.labels.template.paddingRight = 25;
categoryAxis.renderer.minGridDistance = 10;
categoryAxis.renderer.innerRadius = 10;
categoryAxis.renderer.radius = 30;
var dateAxis = chart.xAxes.push(new am4charts.DateAxis());
dateAxis.renderer.points = getPoints();
dateAxis.renderer.autoScale = false;
dateAxis.renderer.autoCenter = false;
dateAxis.renderer.minGridDistance = 30;
dateAxis.baseInterval = { count: 1, timeUnit: "minute" };
dateAxis.renderer.tooltipLocation = 0;
dateAxis.renderer.line.strokeDasharray = "1,4";
dateAxis.renderer.line.strokeOpacity = 0.5;
dateAxis.tooltip.background.fillOpacity = 0.2;
dateAxis.tooltip.background.cornerRadius = 5;
dateAxis.tooltip.label.fill = new am4core.InterfaceColorSet().getFor("alternativeBackground");
dateAxis.tooltip.label.paddingTop = 7;
dateAxis.endLocation = 0;
dateAxis.startLocation = -0.5;
dateAxis.min = new Date(2019, 7, 29, 12, 5).getTime();
dateAxis.max = new Date(2019, 8, 1, 19, 43).getTime();
var labelTemplate = dateAxis.renderer.labels.template;
labelTemplate.verticalCenter = "middle";
labelTemplate.fillOpacity = 0.6;
labelTemplate.background.fill = new am4core.InterfaceColorSet().getFor("background");
labelTemplate.background.fillOpacity = 1;
labelTemplate.fill = new am4core.InterfaceColorSet().getFor("text");
labelTemplate.padding(7, 7, 7, 7);
var series = chart.series.push(new am4plugins_timeline.CurveColumnSeries());
series.columns.template.height = am4core.percent(30);
series.dataFields.openDateX = "start";
series.dataFields.dateX = "end";
series.dataFields.categoryY = "category";
series.baseAxis = categoryAxis;
series.columns.template.propertyFields.fill = "color"; // get color from data
series.columns.template.propertyFields.stroke = "color";
series.columns.template.strokeOpacity = 0;
series.columns.template.fillOpacity = 0.6;
var imageBullet1 = series.bullets.push(new am4plugins_bullets.PinBullet());
imageBullet1.background.radius = 18;
imageBullet1.locationX = 1;
imageBullet1.propertyFields.stroke = "color";
imageBullet1.background.propertyFields.fill = "color";
imageBullet1.image = new am4core.Image();
imageBullet1.image.propertyFields.href = "icon";
imageBullet1.image.scale = 0.7;
imageBullet1.circle.radius = 20;
imageBullet1.background.fillOpacity = 0.8;
imageBullet1.background.strokeOpacity = 0;
imageBullet1.dy = -2;
imageBullet1.background.pointerBaseWidth = 10;
imageBullet1.background.pointerLength = 10
imageBullet1.tooltipText = "{text}";
series.tooltip.pointerOrientation = "up";
imageBullet1.background.adapter.add("pointerAngle", (value, target) => {
if (target.dataItem) {
var position = dateAxis.valueToPosition(target.dataItem.openDateX.getTime());
return dateAxis.renderer.positionToAngle(position);
}
return value;
});
var hs = imageBullet1.states.create("hover")
hs.properties.scale = 1.3;
hs.properties.opacity = 1;
var textBullet = series.bullets.push(new am4charts.LabelBullet());
textBullet.label.propertyFields.text = "text";
textBullet.disabled = true;
textBullet.propertyFields.disabled = "textDisabled";
textBullet.label.strokeOpacity = 0;
textBullet.locationX = 1;
textBullet.dy = - 100;
textBullet.label.textAlign = "middle";
chart.scrollbarX = new am4core.Scrollbar();
chart.scrollbarX.align = "center"
chart.scrollbarX.width = am4core.percent(75);
chart.scrollbarX.parent = chart.curveContainer;
chart.scrollbarX.height = 300;
chart.scrollbarX.orientation = "vertical";
chart.scrollbarX.x = 128;
chart.scrollbarX.y = -140;
chart.scrollbarX.isMeasured = false;
chart.scrollbarX.opacity = 0.5;
var cursor = new am4plugins_timeline.CurveCursor();
chart.cursor = cursor;
cursor.xAxis = dateAxis;
cursor.yAxis = categoryAxis;
cursor.lineY.disabled = true;
cursor.lineX.disabled = true;
dateAxis.renderer.tooltipLocation2 = 0;
categoryAxis.cursorTooltipEnabled = false;
chart.zoomOutButton.disabled = true;
var previousBullet;
chart.events.on("inited", function() {
setTimeout(function() {
hoverItem(series.dataItems.getIndex(0));
}, 2000)
})
function hoverItem(dataItem) {
var bullet = dataItem.bullets.getKey(imageBullet1.uid);
var index = dataItem.index;
if (index >= series.dataItems.length - 1) {
index = -1;
}
if (bullet) {
if (previousBullet) {
previousBullet.isHover = false;
}
bullet.isHover = true;
previousBullet = bullet;
}
setTimeout(
function() {
hoverItem(series.dataItems.getIndex(index + 1))
}, 1000);
}
});
function getPoints() {
var points = [{ x: -1300, y: 200 }, { x: 0, y: 200 }];
var w = 400;
var h = 400;
var levelCount = 4;
var radius = am4core.math.min(w / (levelCount - 1) / 2, h / 2);
var startX = radius;
for (var i = 0; i < 25; i++) {
var angle = 0 + i / 25 * 90;
var centerPoint = { y: 200 - radius, x: 0 }
points.push({ y: centerPoint.y + radius * am4core.math.cos(angle), x: centerPoint.x + radius * am4core.math.sin(angle) });
}
for (var i = 0; i < levelCount; i++) {
if (i % 2 != 0) {
points.push({ y: -h / 2 + radius, x: startX + w / (levelCount - 1) * i })
points.push({ y: h / 2 - radius, x: startX + w / (levelCount - 1) * i })
var centerPoint = { y: h / 2 - radius, x: startX + w / (levelCount - 1) * (i + 0.5) }
if (i < levelCount - 1) {
for (var k = 0; k < 50; k++) {
var angle = -90 + k / 50 * 180;
points.push({ y: centerPoint.y + radius * am4core.math.cos(angle), x: centerPoint.x + radius * am4core.math.sin(angle) });
}
}
if (i == levelCount - 1) {
points.pop();
points.push({ y: -radius, x: startX + w / (levelCount - 1) * i })
var centerPoint = { y: -radius, x: startX + w / (levelCount - 1) * (i + 0.5) }
for (var k = 0; k < 25; k++) {
var angle = -90 + k / 25 * 90;
points.push({ y: centerPoint.y + radius * am4core.math.cos(angle), x: centerPoint.x + radius * am4core.math.sin(angle) });
}
points.push({ y: 0, x: 1300 });
}
}
else {
points.push({ y: h / 2 - radius, x: startX + w / (levelCount - 1) * i })
points.push({ y: -h / 2 + radius, x: startX + w / (levelCount - 1) * i })
var centerPoint = { y: -h / 2 + radius, x: startX + w / (levelCount - 1) * (i + 0.5) }
if (i < levelCount - 1) {
for (var k = 0; k < 50; k++) {
var angle = -90 - k / 50 * 180;
points.push({ y: centerPoint.y + radius * am4core.math.cos(angle), x: centerPoint.x + radius * am4core.math.sin(angle) });
}
}
}
}
return points;
}
}); // end am4core.ready()
</script>
你能帮我在项目符号内的图片周围应用边框半径吗?
您可以调整项目符号内 circle
和 background
对象中的 radius
属性,以用圆边遮盖图像并控制项目符号的大小。在您的情况下,将圆半径降低到 13 就足够了:
var imageBullet1 = series.bullets.push(new am4plugins_bullets.PinBullet());
// ...
imageBullet1.circle.radius = 13;
您可能会发现 bullet configuration tool from the bullet plugin tutorial 有助于理解某些属性如何影响项目符号的外观。
我想更改项目符号中的图像以使时间线变圆。 我正在尝试用 css 覆盖 css!重要和 jquery。但我无法更改子弹内的图像
看看我的codepen https://codepen.io/levicosta201/pen/RwwQJXV
<div id="chartdiv" style="height: 500px !important;"></div>
<script src="https://www.amcharts.com/lib/4/core.js"></script>
<script src="https://www.amcharts.com/lib/4/charts.js"></script>
<script src="https://www.amcharts.com/lib/4/themes/material.js"></script>
<script src="https://www.amcharts.com/lib/4/themes/animated.js"></script>
<script src="https://www.amcharts.com/lib/4/plugins/timeline.js"></script>
<script src="https://www.amcharts.com/lib/4/plugins/bullets.js"></script>
<script>
//Chart IoTs sequence
am4core.ready(function() {
// Themes begin
am4core.useTheme(am4themes_animated);
// Themes end
am4core.ready(function() {
var chart = am4core.create("chartdiv", am4plugins_timeline.CurveChart);
chart.curveContainer.padding(100, 20, 50, 20);
chart.maskBullets = false;
var colorSet = new am4core.ColorSet();
chart.dateFormatter.inputDateFormat = "yyyy-MM-dd HH:mm";
chart.dateFormatter.dateFormat = "HH";
const iotIcon = "data:image/png;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4TIiaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLwA8P3hwYWNrZXQgYmVnaW49Iu+7vyIgaWQ9Ilc1TTBNcENlaGlIenJlU3pOVGN6a2M5ZCI/Pgo8eDp4bXBtZXRhIHhtbG5zOng9ImFkb2JlOm5zOm1ldGEvIiB4OnhtcHRrPSJBZG9iZSBYTVAgQ29yZSA1LjMtYzAxMSA2Ni4xNDU2NjEsIDIwMTIvMDIvMDYtMTQ6NTY6MjcgICAgICAgICI+CiAgIDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+CiAgICAgIDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiCiAgICAgICAgICAgIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyI+CiAgICAgICAgIDx4bXA6Q3JlYXRvclRvb2w+QWRvYmUgRmlyZXdvcmtzIENTNiAoV2luZG93cyk8L3htcDpDcmVhdG9yVG9vbD4KICAgICAgICAgPHhtcDpDcmVhdGVEYXRlPjIwMTktMDgtMTdUMTk6NTM6MzFaPC94bXA6Q3JlYXRlRGF0ZT4KICAgICAgICAgPHhtcDpNb2RpZnlEYXRlPjIwMTktMDgtMTdUMTk6NTM6NDNaPC94bXA6TW9kaWZ5RGF0ZT4KICAgICAgPC9yZGY6RGVzY3JpcHRpb24+CiAgICAgIDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiCiAgICAgICAgICAgIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAKPD94cGFja2V0IGVuZD0idyI/Pv/bAEMABwQEBAUEBwUFBwoHBQcKDAkHBwkMDQsLDAsLDRENDQ0NDQ0RDQ8QERAPDRQUFhYUFB4dHR0eIiIiIiIiIiIiIv/bAEMBCAcHDQwNGBAQGBoVERUaICAgICAgICAgICAgICEgICAgICAhISEgICAhISEhISEhISIiIiIiIiIiIiIiIiIiIv/AABEIAMwAzAMBEQACEQEDEQH/xAAcAAEAAgMBAQEAAAAAAAAAAAAAAQIEBQYDBwj/xABGEAABAwIDAwcIBQsDBQAAAAAAAQIDBAUREjEGIUEHEyJRYXGRFDJCcoGhsdEjJDNSwRU0NUNTYnOCkrLhNsLSZJOis/D/xAAUAQEAAAAAAAAAAAAAAAAAAAAA/8QAFBEBAAAAAAAAAAAAAAAAAAAAAP/aAAwDAQACEQMRAD8A/SIACjtQIAAAAAAAAAAAAAAAAAAAAAAAXboBIAAAAo7UCAAAAAAAFVETFdycVA09x2ws9G5WNcs8qehHp4rgBpqjlArnL9Xp42JwzK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cvu+YG4ouTe1RYOqpXzr1Jg1PcBvaCzWug/NKdka9eG/xXeBlAAAAC7dAJAAAAFHagQAAAAAAAAAAAAAAAAAAAAAAAu3QCQAAABR2oEAAAAAAAAAAAAAAAAAAAAAAALt0AkAB/9k=";
chart.data = [{
"category": "Aiknow - Entrance",
"start": "2019-08-30 12:05",
"end": "2019-08-30 16:25",
"color": "#F60",
"icon": iotIcon,
"text": "Aiknow - Entrance"
},
{
"category": "Aiknow - Entrance",
"start": "2019-08-30 16:25",
"end": "2019-08-30 19:40",
"color": "#F00",
"icon": iotIcon,
"text": "Aiknow - Entrance"
},
{
"category": "Aiknow - Entrance",
"start": "2019-08-30 19:40",
"end": "2019-08-30 19:43",
"color": "#690310",
"icon": iotIcon,
"text": "Aiknow - Entrance"
}
];
chart.fontSize = 10;
chart.tooltipContainer.fontSize = 10;
var categoryAxis = chart.yAxes.push(new am4charts.CategoryAxis());
categoryAxis.dataFields.category = "category";
categoryAxis.renderer.grid.template.disabled = true;
categoryAxis.renderer.labels.template.paddingRight = 25;
categoryAxis.renderer.minGridDistance = 10;
categoryAxis.renderer.innerRadius = 10;
categoryAxis.renderer.radius = 30;
var dateAxis = chart.xAxes.push(new am4charts.DateAxis());
dateAxis.renderer.points = getPoints();
dateAxis.renderer.autoScale = false;
dateAxis.renderer.autoCenter = false;
dateAxis.renderer.minGridDistance = 30;
dateAxis.baseInterval = { count: 1, timeUnit: "minute" };
dateAxis.renderer.tooltipLocation = 0;
dateAxis.renderer.line.strokeDasharray = "1,4";
dateAxis.renderer.line.strokeOpacity = 0.5;
dateAxis.tooltip.background.fillOpacity = 0.2;
dateAxis.tooltip.background.cornerRadius = 5;
dateAxis.tooltip.label.fill = new am4core.InterfaceColorSet().getFor("alternativeBackground");
dateAxis.tooltip.label.paddingTop = 7;
dateAxis.endLocation = 0;
dateAxis.startLocation = -0.5;
dateAxis.min = new Date(2019, 7, 29, 12, 5).getTime();
dateAxis.max = new Date(2019, 8, 1, 19, 43).getTime();
var labelTemplate = dateAxis.renderer.labels.template;
labelTemplate.verticalCenter = "middle";
labelTemplate.fillOpacity = 0.6;
labelTemplate.background.fill = new am4core.InterfaceColorSet().getFor("background");
labelTemplate.background.fillOpacity = 1;
labelTemplate.fill = new am4core.InterfaceColorSet().getFor("text");
labelTemplate.padding(7, 7, 7, 7);
var series = chart.series.push(new am4plugins_timeline.CurveColumnSeries());
series.columns.template.height = am4core.percent(30);
series.dataFields.openDateX = "start";
series.dataFields.dateX = "end";
series.dataFields.categoryY = "category";
series.baseAxis = categoryAxis;
series.columns.template.propertyFields.fill = "color"; // get color from data
series.columns.template.propertyFields.stroke = "color";
series.columns.template.strokeOpacity = 0;
series.columns.template.fillOpacity = 0.6;
var imageBullet1 = series.bullets.push(new am4plugins_bullets.PinBullet());
imageBullet1.background.radius = 18;
imageBullet1.locationX = 1;
imageBullet1.propertyFields.stroke = "color";
imageBullet1.background.propertyFields.fill = "color";
imageBullet1.image = new am4core.Image();
imageBullet1.image.propertyFields.href = "icon";
imageBullet1.image.scale = 0.7;
imageBullet1.circle.radius = 20;
imageBullet1.background.fillOpacity = 0.8;
imageBullet1.background.strokeOpacity = 0;
imageBullet1.dy = -2;
imageBullet1.background.pointerBaseWidth = 10;
imageBullet1.background.pointerLength = 10
imageBullet1.tooltipText = "{text}";
series.tooltip.pointerOrientation = "up";
imageBullet1.background.adapter.add("pointerAngle", (value, target) => {
if (target.dataItem) {
var position = dateAxis.valueToPosition(target.dataItem.openDateX.getTime());
return dateAxis.renderer.positionToAngle(position);
}
return value;
});
var hs = imageBullet1.states.create("hover")
hs.properties.scale = 1.3;
hs.properties.opacity = 1;
var textBullet = series.bullets.push(new am4charts.LabelBullet());
textBullet.label.propertyFields.text = "text";
textBullet.disabled = true;
textBullet.propertyFields.disabled = "textDisabled";
textBullet.label.strokeOpacity = 0;
textBullet.locationX = 1;
textBullet.dy = - 100;
textBullet.label.textAlign = "middle";
chart.scrollbarX = new am4core.Scrollbar();
chart.scrollbarX.align = "center"
chart.scrollbarX.width = am4core.percent(75);
chart.scrollbarX.parent = chart.curveContainer;
chart.scrollbarX.height = 300;
chart.scrollbarX.orientation = "vertical";
chart.scrollbarX.x = 128;
chart.scrollbarX.y = -140;
chart.scrollbarX.isMeasured = false;
chart.scrollbarX.opacity = 0.5;
var cursor = new am4plugins_timeline.CurveCursor();
chart.cursor = cursor;
cursor.xAxis = dateAxis;
cursor.yAxis = categoryAxis;
cursor.lineY.disabled = true;
cursor.lineX.disabled = true;
dateAxis.renderer.tooltipLocation2 = 0;
categoryAxis.cursorTooltipEnabled = false;
chart.zoomOutButton.disabled = true;
var previousBullet;
chart.events.on("inited", function() {
setTimeout(function() {
hoverItem(series.dataItems.getIndex(0));
}, 2000)
})
function hoverItem(dataItem) {
var bullet = dataItem.bullets.getKey(imageBullet1.uid);
var index = dataItem.index;
if (index >= series.dataItems.length - 1) {
index = -1;
}
if (bullet) {
if (previousBullet) {
previousBullet.isHover = false;
}
bullet.isHover = true;
previousBullet = bullet;
}
setTimeout(
function() {
hoverItem(series.dataItems.getIndex(index + 1))
}, 1000);
}
});
function getPoints() {
var points = [{ x: -1300, y: 200 }, { x: 0, y: 200 }];
var w = 400;
var h = 400;
var levelCount = 4;
var radius = am4core.math.min(w / (levelCount - 1) / 2, h / 2);
var startX = radius;
for (var i = 0; i < 25; i++) {
var angle = 0 + i / 25 * 90;
var centerPoint = { y: 200 - radius, x: 0 }
points.push({ y: centerPoint.y + radius * am4core.math.cos(angle), x: centerPoint.x + radius * am4core.math.sin(angle) });
}
for (var i = 0; i < levelCount; i++) {
if (i % 2 != 0) {
points.push({ y: -h / 2 + radius, x: startX + w / (levelCount - 1) * i })
points.push({ y: h / 2 - radius, x: startX + w / (levelCount - 1) * i })
var centerPoint = { y: h / 2 - radius, x: startX + w / (levelCount - 1) * (i + 0.5) }
if (i < levelCount - 1) {
for (var k = 0; k < 50; k++) {
var angle = -90 + k / 50 * 180;
points.push({ y: centerPoint.y + radius * am4core.math.cos(angle), x: centerPoint.x + radius * am4core.math.sin(angle) });
}
}
if (i == levelCount - 1) {
points.pop();
points.push({ y: -radius, x: startX + w / (levelCount - 1) * i })
var centerPoint = { y: -radius, x: startX + w / (levelCount - 1) * (i + 0.5) }
for (var k = 0; k < 25; k++) {
var angle = -90 + k / 25 * 90;
points.push({ y: centerPoint.y + radius * am4core.math.cos(angle), x: centerPoint.x + radius * am4core.math.sin(angle) });
}
points.push({ y: 0, x: 1300 });
}
}
else {
points.push({ y: h / 2 - radius, x: startX + w / (levelCount - 1) * i })
points.push({ y: -h / 2 + radius, x: startX + w / (levelCount - 1) * i })
var centerPoint = { y: -h / 2 + radius, x: startX + w / (levelCount - 1) * (i + 0.5) }
if (i < levelCount - 1) {
for (var k = 0; k < 50; k++) {
var angle = -90 - k / 50 * 180;
points.push({ y: centerPoint.y + radius * am4core.math.cos(angle), x: centerPoint.x + radius * am4core.math.sin(angle) });
}
}
}
}
return points;
}
}); // end am4core.ready()
</script>
你能帮我在项目符号内的图片周围应用边框半径吗?
您可以调整项目符号内 circle
和 background
对象中的 radius
属性,以用圆边遮盖图像并控制项目符号的大小。在您的情况下,将圆半径降低到 13 就足够了:
var imageBullet1 = series.bullets.push(new am4plugins_bullets.PinBullet());
// ...
imageBullet1.circle.radius = 13;
您可能会发现 bullet configuration tool from the bullet plugin tutorial 有助于理解某些属性如何影响项目符号的外观。