Skip to content

Added Java type Config Object to get chart URL instead of providing non-formatted json string - #9

Open
nimxch wants to merge 1 commit into
typpo:mainfrom
nimxch:main
Open

Added Java type Config Object to get chart URL instead of providing non-formatted json string#9
nimxch wants to merge 1 commit into
typpo:mainfrom
nimxch:main

Conversation

@nimxch

Copy link
Copy Markdown

If user want to provide your Chart.js config in a neat manner instead of doing all the string formatting, you can use getUrlV2()

Example:

// Instanciate ChartConfig objectChartConfigconfig = newChartConfig();
// Set the char type. e.g bar, line etcconfig.setType("bar");
//Instantiate ChartDataChartDatadata = newChartData();
// Set the labels and chart Datadata.setLabels(List.of("Q1", "Q2", "Q3", "Q4")); //labels//Dataset 1Datasetdataset = newDataset();
dataset.setLabel("Users");
dataset.setData(List.of("50", "60", "70", "180"));
//Dataset 2Datasetdataset2 = newDataset();
dataset2.setLabel("Revenue");
dataset2.setData(List.of("100", "200", "300", "400"));
//Set the required Datadata.setDatasets(List.of(dataset, dataset2));
config.setData(data);
chart.setChartConfig(config);
//get the URLchart.getUrlV2()

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@nimxch