Click here to Skip to main content
15,886,639 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Am using apex chart (radialbar) for display values but when i click for chart redirect to another page with parameter value. but i try below code but selected value return "undefined"


What I have tried:

var _majordemo12 = function () {
		const apexChart = "#majorchart_12";
		var options = {
			series: @Html.Raw(Json.Encode(TempData["chart_majorvalue"])),
			chart: {
				width: 380,
                type: 'radialBar',
                events: {                    
                    dataPointSelection: function (event, chartContext, config) {
                        // Get the selected data point's value and redirect to another page
                        var selectedValue = config.w.globals.series[config.seriesIndex][config.dataPointIndex];
                        console.log(selectedValue);
                        //window.location.href = 'another-page.aspx?selectedValue=' + selectedValue;
                    }
                }
			},
			labels: @Html.Raw(Json.Encode(TempData["chart_majorname"])),
			responsive: [{
				breakpoint: 480,
				options: {
					chart: {
						width: 200
					},
					legend: {
						position: 'bottom'
					}
				}
            }],
            legend: {
                position: 'bottom',
                show: false
					},
			//colors: [ danger, info,primary, success, warning]
            theme: {
                palette: 'palette6' // upto palette10
            }
		};

		var chart = new ApexCharts(document.querySelector(apexChart), options);
		chart.render();
	}
Posted
Updated 20-Apr-23 2:06am
v2

1 solution

You might want to ask your question in the forum dedicated to ApexCharts, here[^].
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900