amcharts / amcharts4

The most advanced amCharts charting library for JavaScript and TypeScript apps.
https://www.amcharts.com/
1.16k stars 322 forks source link

Year Decrement Issue in .amcharts-end-date-input and .amcharts-start-date-input Fields #4326

Closed abhayjain2023 closed 1 year ago

abhayjain2023 commented 1 year ago

"When I focus on the .amcharts-end-date-input and .amcharts-start-date-input, and then click outside the input box, the year's value automatically decreases by 1. For example, if the current value is 2022 and I focus on the input box and then click outside it, the value changes to 2021. This same scenario occurs every time in both input boxes."

Here is the below image for reference, also I have attached the code snippet.

` var chart = AmCharts.makeChart("chartdiv", { "pathToImages": "../images/", "type": "stock", "theme": "none", "precision": 1, "dataSets": dataArray, "periodSelector": { "position": "bottom", "color": "#002c77", "dateFormat": "YYYY", "fromText": PeriodText, "toText": "- ", "periods": [ { period: "YYYY", count: 1, label: "1 Y" }, { period: "YYYY", count: 2, label: "2 Y" }, { period: "YYYY", count: 4, label: "4 Y" }, { period: "YYYY", count: 8, label: "8 Y" }, { period: "MAX", selected: true, label: "Max" } ], } })

`

image

@martynasma Can you please help me in this?

xorspark commented 1 year ago

The code you provided is for amCharts v3, not v4, so this is the wrong repo. v3 is no longer supported.

abhayjain2023 commented 1 year ago

@xorspark This code is for Amchart4

var chart = AmCharts.makeChart("chartdiv", { "pathToImages": "../images/", "type": "stock", "theme": "none", "precision": 1, "dataSets": dataArray, "panels": [{}], "periodSelector": { "position": "bottom", "color": "#002c77", "dateFormat": "YYYY", "fromText": PeriodText, "toText": "- ", "periods": [ { period: "YYYY", count: 1, label: "1 Y" }, { period: "YYYY", count: 2, label: "2 Y" }, { period: "YYYY", count: 4, label: "4 Y" }, { period: "YYYY", count: 8, label: "8 Y" }, { period: "MAX", selected: true, label: "Max" } ], } })

xorspark commented 1 year ago

@abhayjain2023 - No it's not. AmCharts.makeChart is v3. There is no such method in v4.

In addition, those CSS class names are in v3's stock chart period selector.

Here's a comparison:

v3: https://www.amcharts.com/demos-v3/stock-events-v3/

v4: https://codepen.io/team/amcharts/pen/bGEVbJj