mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-24 09:28:31 +00:00
Feature: Ability to toggle chart grid lines
This commit is contained in:
parent
8cca2862be
commit
c2ee24662a
3 changed files with 10 additions and 4 deletions
|
|
@ -35,12 +35,14 @@ export const Chart = function Chart({
|
|||
const markerColorProperty = component.definition.properties.markerColor;
|
||||
const markerColor = markerColorProperty ? markerColorProperty.value : 'red';
|
||||
|
||||
const gridLinesProperty = component.definition.properties.showGridLines;
|
||||
const showGridLines = gridLinesProperty ? gridLinesProperty.value : true;
|
||||
|
||||
const chartData = [{
|
||||
type: chartType || 'line',
|
||||
x: data.map((item) => item["x"]),
|
||||
y: data.map((item) => item["y"]),
|
||||
marker: { color: markerColor },
|
||||
xaxis: { showgrid: false }
|
||||
marker: { color: markerColor }
|
||||
}];
|
||||
|
||||
const layout = {
|
||||
|
|
@ -48,11 +50,11 @@ export const Chart = function Chart({
|
|||
height,
|
||||
title,
|
||||
xaxis: {
|
||||
showgrid: true,
|
||||
showgrid: showGridLines,
|
||||
showline: true
|
||||
},
|
||||
yaxis: {
|
||||
showgrid: true,
|
||||
showgrid: showGridLines,
|
||||
showline: true
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,6 +127,7 @@ export const componentTypes = [
|
|||
data: { type: 'json', displayName: 'Data' },
|
||||
loadingState: { type: 'code', displayName: 'Loading State'},
|
||||
markerColor: { type: 'color', displayName: 'Marker color'},
|
||||
showGridLines: { type: 'toggle', displayName: 'Show grid lines'},
|
||||
type: { type: 'select', displayName: 'Chart type', options: [
|
||||
{ name: 'Line', value: 'line' },
|
||||
{ name: 'Bar', value: 'bar' }
|
||||
|
|
@ -143,6 +144,7 @@ export const componentTypes = [
|
|||
properties: {
|
||||
title: { value: 'This title can be changed' },
|
||||
markerColor: { value: 'red' },
|
||||
showGridLines: { value: true },
|
||||
loadingState: { value: `{{false}}` },
|
||||
type: { value: `line` },
|
||||
data: { value: `[
|
||||
|
|
|
|||
|
|
@ -83,6 +83,8 @@ class Chart extends React.Component {
|
|||
{renderElement(component, componentMeta, paramUpdated, dataQueries, 'loadingState', 'properties', currentState)}
|
||||
|
||||
{renderElement(component, componentMeta, paramUpdated, dataQueries, 'markerColor', 'properties', currentState)}
|
||||
|
||||
{renderElement(component, componentMeta, paramUpdated, dataQueries, 'showGridLines', 'properties', currentState)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue