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

Different colors for different datapoints for multi series chart #599

Open
imran-mirza79 opened this issue May 1, 2024 · 1 comment
Open

Comments

@imran-mirza79
Copy link

imran-mirza79 commented May 1, 2024

Hi, I wanted to have different colors for each bar of each dataset. I tried multiple chart options, but none worked.

Sharing a screenshot of expected result and my chart options for better clarity. Thanks!

image

My chart options

const colors1 = [
		"#FF008A",
		"#044778",
		"#000000",
		"#FF0000",
		"#0000FF",
		secondary,
	];

	const colors2 = [
		"white",
		"#FF5733",
		"#C70039",
		"#900C3F",
		"#581845",
		"#FF5733",
	];
	// chart
	const optionscolumnchart: any = {
		chart: {
			type: "bar",
			fontFamily: "'Plus Jakarta Sans', sans-serif;",
			foreColor: "#adb0bb",
			toolbar: {
				show: true,
			},
			height: 370,
		},

		plotOptions: {
			bar: {
				distributed: true,
				horizontal: true,
				barHeight: "60%",
				columnWidth: "42%",
				borderRadius: [6],
				borderRadiusApplication: "end",
				borderRadiusWhenStacked: "all",
			},
		},
		stroke: {
			show: true,
			width: 5,
			lineCap: "butt",
			colors: ["transparent"],
		},
		dataLabels: {
			enabled: false,
		},
		legend: {
			show: false,
		},
		grid: {
			borderColor: "rgba(0,0,0,0.1)",
			strokeDashArray: 3,
			xaxis: {
				lines: {
					show: false,
				},
			},
		},
		yaxis: {
			tickAmount: 4,
		},
		xaxis: {
			categories: [100,200,300,400,500,700],
			axisBorder: {
				show: false,
			},
		},
		tooltip: {
			theme: "dark",
			fillSeriesColor: false,
		},
	};
	const seriescolumnchart: any = [
		{
			name: "Series A",
			data: [2000,3000,5000,7000,5000,9000],
			colors: colors1,
		},
		{
			name: "Series B",
			data: [1000, 2000, 3250, 2500, 310, 2050],
			colors: colors2,
		},
	];

Though I added different color properties for both the series, the color remains the same. Any help here would be appreciated, Thanks!

Copy link

github-actions bot commented Aug 2, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

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

No branches or pull requests

1 participant