In regular google charts I used to hide a column in google charts that didn't want to appear with below steps.
view = new google.visualization.DataView(data);
view.hideColumns([2]);
chart.draw(view, options)
now that I am developing react Application and using (React google charts) but can't find an option to hide a specific column e.g column ID in chart graph, I could remove it from Json data but I need that value later on when the user click the chart for drill down.
import React from "react";
import { Chart } from "react-google-charts";
const data = [
{
Element: "Copper",
Density: 12,
Id: 1,
},
{
Element: "Silver",
Density: 18,
Id: 2,
},
{
Element: "Gold",
Density: 13,
Id: 3,
},
{
Element: "Platinum",
Density: 9,
Id: 4,
}
];
const result = [["Element", "Density", "Id"]];
for (let i = 0; i < data.length; i++) {
result.push([data[i].Element, data[i].Density, data[i].Id]);
}
export function App() {
return (
<Chart chartType="ColumnChart" width="100%" height="400px" data={result} />
);
}