You can create a bullet sparkline using the BulletSparkline function in a formula: =BULLETSPARKLINE(measure, target, maxi, good?, bad?, forecast?, tickunit?, colorScheme?, vertical?, measureColor?, targetColor?, maxiColor?, goodColor?, badColor?, forecastColor?, allowMeasureOverMaxi?, barSize?).
The function has the following parameters:
measure: Number or reference that represents the length of the measure bar, such as 5 or "A1".
target: Number or reference that represents the location of the target line, such as 7 or "A2".
maxi: Number or reference that represents the maximum value of the sparkline, such as 10 or "A3".
good: (optional) Number or reference that represents the length of the good bar, such as 3 or "A4"; default value is 0.
bad: (optional) Number or reference that represents the length of the bad bar, such as 1 or "A5"; default value is 0.
forecast: (optional) Number or reference that represents the length of the forecast line, such as 8 or "A6"; default value is 0.
tickunit: (optional) Number or reference that represents the tick unit, such as 1 or "A7"; default value is 0.
colorScheme: (optional) String that represents the color scheme for generating a group of colors to display the sparkline; default value is "#A0A0A0".
vertical: (optional) Boolean that represents whether to display the sparkline vertically; default value is false.
measureColor: (optional) String that represents the color of measure bar.
targetColor: (optional) String that represents the color of target line.
maxiColor: (optional) String that represents the maxi area color.
goodColor: (optional) String that represents the good area color.
badColor: (optional) String that represents the bad area color.
forecastColor: (optional) String that represents the forecast line color.
allowMeasureOverMaxi: (optional) Boolean that represents if the measure could exceed maxi area; default value is false.
barSize: (optional) Number that represents that the percentage of bar width/height according to the cell height/ width. (value > 0 && value <= 1)
import * as React from 'react';
import { createRoot } from 'react-dom/client';
import './styles.css';
import { AppFunc } from './app-func';
// import { App } from './app-class';
// 1. Functional Component sample
createRoot(document.getElementById('app')).render(<AppFunc />);
// 2. Class Component sample
// createRoot(document.getElementById('app')).render(<App />);
import * as React from 'react';
import GC from '@mescius/spread-sheets';
import { SpreadSheets, Worksheet } from '@mescius/spread-sheets-react';
var spreadNS = GC.Spread.Sheets;
let spread = null;
export function AppFunc() {
const [bulletOption, setBulletOption] = React.useState({
colorScheme: '#FFFFFF',
measureColor: '#000000',
targetColor: '#F7A711',
maxiColor: '#DDDDDD',
goodColor: '#BBBBBB',
badColor: '#999999',
forecastColor: '#FFFFFF',
allowMeasureOverMaxi: true,
barSize: '0.7'
});
React.useEffect(() => {
applyChanges();
}, [bulletOption]);
const colorSchemeChange = (e) => {
let value = e.target.value;
setBulletOption({ ...bulletOption, colorScheme: value });
}
const measureColorChange = (e) => {
let value = e.target.value;
setBulletOption({ ...bulletOption, measureColor: value });
}
const targetColorChange = (e) => {
let value = e.target.value;
setBulletOption({ ...bulletOption, targetColor: value });
}
const maxiColorChange = (e) => {
let value = e.target.value;
setBulletOption({ ...bulletOption, maxiColor: value });
}
const goodColorChange = (e) => {
let value = e.target.value;
setBulletOption({ ...bulletOption, goodColor: value });
}
const badColorChange = (e) => {
let value = e.target.value;
setBulletOption({ ...bulletOption, badColor: value });
}
const forecastColorChange = (e) => {
let value = e.target.value;
setBulletOption({ ...bulletOption, forecastColor: value });
}
const allowMeasureOverMaxiChange = (e) => {
let value = e.target.checked;
setBulletOption({ ...bulletOption, allowMeasureOverMaxi: value });
}
const barSizeChange = (e) => {
let value = e.target.value;
setBulletOption({ ...bulletOption, barSize: value });
}
const initHorizontalSparkline = (sheet, name) => {
sheet.suspendPaint();
sheet.name(name);
sheet.addSpan(1, 1, 1, 8);
sheet.getCell(1, 1).value("Revenue By Region (million $)")
.font("20px Calibri").hAlign(spreadNS.HorizontalAlign.center).vAlign(spreadNS.VerticalAlign.center)
.foreColor("white").backColor("#82bc00");
sheet.getRange(2, 1, 1, 8).vAlign(spreadNS.VerticalAlign.center)
.font("bold 16px Calibri")
.backColor("#F4F8EB");
sheet.getRange(3, 1, 6, 7).font("20px").vAlign(spreadNS.HorizontalAlign.center);
sheet.getRange(2, 1, 7, 8).setBorder(new GC.Spread.Sheets.LineBorder("Black", GC.Spread.Sheets.LineStyle.thin), {
all: true
});
sheet.getRange(3, 1, 6, 8).setBorder(new GC.Spread.Sheets.LineBorder("Black", GC.Spread.Sheets.LineStyle.dotted), {
inside: true
});
sheet.setArray(2, 2, [
['Region', 'Forecast', 'Actual', 'Target', 'Max', 'Optimist F.', 'Pessimist F.', ' '],
['North America', 80, 75, 70, 95, 65, 50],
['South America', 79, 62, 80, 95, 75, 50],
['Europe', 95, 100, 100, 120, 90, 80],
['Azia', 80, 95, 80, 90, 70, 55],
['Australia', 35, 20, 40, 50, 35, 15],
['Africa', 34, 40, 30, 50, 20, 15]
]);
for (var index = 3; index < 9; index++) {
sheet.setFormula(index, 1, '=BULLETSPARKLINE($E' + (index + 1) + ',' +
'$F' + (index + 1) + ',' +
'$G' + (index + 1) + ',' +
'$H' + (index + 1) + ',' +
'$I' + (index + 1) + ',' +
'$D' + (index + 1) + ',1,"#FFFFFF",false,"#000000","#F7A711","#DDDDDD","#BBBBBB","#999999","#FFFFFF",TRUE,0.7');
}
sheet.setRowHeight(1, 30);
for (var i = 3; i < 9; i++) {
sheet.setRowHeight(i, 40);
}
for (var j = 2; j < 9; j++) {
sheet.setColumnWidth(j, 100);
}
sheet.setColumnWidth(1, 250);
sheet.resumePaint();
}
const initVerticalSparkline = (sheet, name) => {
sheet.suspendPaint();
sheet.name(name);
sheet.addSpan(1, 1, 1, 7);
sheet.getCell(1, 1).value("Revenue By Region (million $)")
.font("20px Calibri").hAlign(spreadNS.HorizontalAlign.center).vAlign(spreadNS.VerticalAlign.center)
.foreColor("white").backColor("#82bc00");
sheet.getRange(2, 1, 7, 1).vAlign(spreadNS.VerticalAlign.center)
.font("bold 16px Calibri")
.backColor("#F4F8EB");
sheet.getRange(2, 2, 7, 6).font("20px").vAlign(spreadNS.HorizontalAlign.center);
sheet.getRange(2, 1, 7, 7).setBorder(new GC.Spread.Sheets.LineBorder("Black", GC.Spread.Sheets.LineStyle.thin), {
all: true
});
sheet.getRange(2, 2, 7, 6).setBorder(new GC.Spread.Sheets.LineBorder("Black", GC.Spread.Sheets.LineStyle.dotted), {
inside: true
});
sheet.setArray(2, 1, [
['Region', 'North America', 'South America', 'Europe', 'Azia', 'Australia', 'Africa'],
['Forecast', 80, 79, 95, 80, 35, 34],
['Actual', 75, 62, 100, 95, 20, 40],
['Target', 70, 80, 100, 80, 40, 30],
['Max', 95, 95, 120, 90, 50, 50],
['Optimist F.', 65, 75, 90, 70, 35, 20],
['Pessimist F.', 50, 50, 80, 55, 15, 15]
]);
for (var index = 2; index < 8; index++) {
var columnChar = String.fromCharCode(65 + index);
sheet.setFormula(9, index, '=BULLETSPARKLINE($' + columnChar + '5,' +
'$' + columnChar + '6,' +
'$' + columnChar + '7,' +
'$' + columnChar + '8,' +
'$' + columnChar + '9,' +
'$' + columnChar + '4,1,"#FFFFFF",TRUE,"#000000","#F7A711","#DDDDDD","#BBBBBB","#999999","#FFFFFF",TRUE,0.7');
}
sheet.setRowHeight(1, 30);
sheet.setRowHeight(9, 200);
for (var j = 1; j < 8; j++) {
sheet.setColumnWidth(j, 100);
}
sheet.resumePaint();
}
const applyChanges = () => {
let sheet = spread.getActiveSheet();
if (spread.getActiveSheetIndex() == 0) {
for (var index = 3; index < 9; index++) {
sheet.setFormula(index, 1, '=BULLETSPARKLINE($E' + (index + 1) + ',' +
'$F' + (index + 1) + ',' +
'$G' + (index + 1) + ',' +
'$H' + (index + 1) + ',' +
'$I' + (index + 1) + ',' +
'$D' + (index + 1) + ',1,"' +
bulletOption.colorScheme + '",false,"' +
bulletOption.measureColor + '","' +
bulletOption.targetColor + '","' +
bulletOption.maxiColor + '","' +
bulletOption.goodColor + '","' +
bulletOption.badColor + '","' +
bulletOption.forecastColor + '",' +
bulletOption.allowMeasureOverMaxi + ',' +
bulletOption.barSize);
}
} else if (spread.getActiveSheetIndex() == 1) {
for (var index = 2; index < 8; index++) {
var columnChar = String.fromCharCode(65 + index);
sheet.setFormula(9, index, '=BULLETSPARKLINE($' + columnChar + '5,' +
'$' + columnChar + '6,' +
'$' + columnChar + '7,' +
'$' + columnChar + '8,' +
'$' + columnChar + '9,' +
'$' + columnChar + '4,1,"' +
bulletOption.colorScheme + '",true,"' +
bulletOption.measureColor + '","' +
bulletOption.targetColor + '","' +
bulletOption.maxiColor + '","' +
bulletOption.goodColor + '","' +
bulletOption.badColor + '","' +
bulletOption.forecastColor + '",' +
bulletOption.allowMeasureOverMaxi + ',' +
bulletOption.barSize);
}
}
}
const initSpread = (currSpread) => {
spread = currSpread;
initHorizontalSparkline(spread.sheets[0], "Horizontal");
initVerticalSparkline(spread.sheets[1], "Vertical");
}
return (
<div class="sample-tutorial">
<div class="sample-spreadsheets">
<SpreadSheets workbookInitialized={spread => initSpread(spread)} newTabVisible={false}>
<Worksheet>
</Worksheet>
<Worksheet>
</Worksheet>
</SpreadSheets>
</div>
<Panel panelInfo={bulletOption}
colorSchemeChange={(e) => { colorSchemeChange(e) }}
measureColorChange={(e) => { measureColorChange(e) }}
targetColorChange={(e) => { targetColorChange(e) }}
maxiColorChange={(e) => { maxiColorChange(e) }}
goodColorChange={(e) => { goodColorChange(e) }}
badColorChange={(e) => { badColorChange(e) }}
forecastColorChange={(e) => { forecastColorChange(e) }}
allowMeasureOverMaxiChange={(e) => { allowMeasureOverMaxiChange(e) }}
barSizeChange={(e) => { barSizeChange(e) }}
/>
</div>
);
}
const Panel = (props) => {
const { panelInfo, colorSchemeChange,
measureColorChange,
targetColorChange,
maxiColorChange,
goodColorChange,
badColorChange,
forecastColorChange,
allowMeasureOverMaxiChange,
barSizeChange } = props;
return (
<div class="options-container">
<div>
<label><b>Settings:</b></label>
</div>
<hr />
<div class="option-row">
<label for="color">Color Scheme:</label>
<select id="color" value={panelInfo.colorScheme + ""} onChange={(e) => { colorSchemeChange(e) }} >
<option value="#FFFFFF" selected>White</option>
<option value="#000000">Black</option>
<option value="#F7A711">Orange</option>
<option value="#DDDDDD">LightGrey</option>
<option value="#BBBBBB">Grey</option>
<option value="#999999">DarkGrey</option>
<option value="#82BC00">Green</option>
</select>
</div>
<div class="option-row">
<label for="measure">Measure Color:</label>
<select id="measure" value={panelInfo.measureColor + ""} onChange={(e) => { measureColorChange(e) }} >
<option value="#FFFFFF">White</option>
<option value="#000000" selected>Black</option>
<option value="#F7A711">Orange</option>
<option value="#DDDDDD">LightGrey</option>
<option value="#BBBBBB">Grey</option>
<option value="#999999">DarkGrey</option>
<option value="#82BC00">Green</option>
</select>
</div>
<div class="option-row">
<label for="target">Target Color:</label>
<select id="target" value={panelInfo.targetColor + ""} onChange={(e) => { targetColorChange(e) }} >
<option value="#FFFFFF">White</option>
<option value="#000000">Black</option>
<option value="#F7A711" selected>Orange</option>
<option value="#DDDDDD">LightGrey</option>
<option value="#BBBBBB">Grey</option>
<option value="#999999">DarkGrey</option>
<option value="#82BC00">Green</option>
</select>
</div>
<div class="option-row">
<label for="maxi">Maximum Color:</label>
<select id="maxi" value={panelInfo.maxiColor + ""} onChange={(e) => { maxiColorChange(e) }} >
<option value="#FFFFFF">White</option>
<option value="#000000">Black</option>
<option value="#F7A711">Orange</option>
<option value="#DDDDDD" selected>LightGrey</option>
<option value="#BBBBBB">Grey</option>
<option value="#999999">DarkGrey</option>
<option value="#82BC00">Green</option>
</select>
</div>
<div class="option-row">
<label for="good">Optimist Color:</label>
<select id="good" value={panelInfo.goodColor + ""} onChange={(e) => { goodColorChange(e) }} >
<option value="#FFFFFF">White</option>
<option value="#000000">Black</option>
<option value="#F7A711">Orange</option>
<option value="#DDDDDD">LightGrey</option>
<option value="#BBBBBB" selected>Grey</option>
<option value="#999999">DarkGrey</option>
<option value="#82BC00">Green</option>
</select>
</div>
<div class="option-row">
<label for="bad">Pessimist Color:</label>
<select id="bad" value={panelInfo.badColor + ""} onChange={(e) => { badColorChange(e) }} >
<option value="#FFFFFF">White</option>
<option value="#000000">Black</option>
<option value="#F7A711">Orange</option>
<option value="#DDDDDD">LightGrey</option>
<option value="#BBBBBB">Grey</option>
<option value="#999999" selected>DarkGrey</option>
<option value="#82BC00">Green</option>
</select>
</div>
<div class="option-row">
<label for="forecast">Forecast Color:</label>
<select id="forecast" value={panelInfo.forecastColor + ""} onChange={(e) => { forecastColorChange(e) }} >
<option value="#FFFFFF" selected>White</option>
<option value="#000000">Black</option>
<option value="#F7A711">Orange</option>
<option value="#DDDDDD">LightGrey</option>
<option value="#BBBBBB">Grey</option>
<option value="#999999">DarkGrey</option>
<option value="#82BC00">Green</option>
</select>
</div>
<div >
<input type="checkbox" id="allowMeasure" value={panelInfo.allowMeasureOverMaxi + ""} onClick={(e) => { allowMeasureOverMaxiChange(e) }} defaultChecked="true" />
<label for="allowMeasure">Allow Measure Over Max</label>
</div>
<div class="option-row">
<label for="size">Bar Size:</label>
<input type="text" id="size" value={panelInfo.barSize + ""} onChange={(e) => { barSizeChange(e) }} />
</div>
</div>
)
}
import * as React from 'react';
import GC from '@mescius/spread-sheets';
import { SpreadSheets, Worksheet } from '@mescius/spread-sheets-react';
const Component = React.Component;
var spreadNS = GC.Spread.Sheets;
export class App extends Component {
constructor(props) {
super(props);
this.spread = null;
this.state = {
colorScheme: '#FFFFFF',
measureColor: '#000000',
targetColor: '#F7A711',
maxiColor: '#DDDDDD',
goodColor: '#BBBBBB',
badColor: '#999999',
forecastColor: '#FFFFFF',
allowMeasureOverMaxi: true,
barSize: '0.7'
};
}
render() {
return (
<div class="sample-tutorial">
<div class="sample-spreadsheets">
<SpreadSheets workbookInitialized={spread => this.initSpread(spread)} newTabVisible={false}>
<Worksheet>
</Worksheet>
<Worksheet>
</Worksheet>
</SpreadSheets>
</div>
<Panel panelInfo={this.state}
colorSchemeChange={(e) => { this.colorSchemeChange(e) }}
measureColorChange={(e) => { this.measureColorChange(e) }}
targetColorChange={(e) => { this.targetColorChange(e) }}
maxiColorChange={(e) => { this.maxiColorChange(e) }}
goodColorChange={(e) => { this.goodColorChange(e) }}
badColorChange={(e) => { this.badColorChange(e) }}
forecastColorChange={(e) => { this.forecastColorChange(e) }}
allowMeasureOverMaxiChange={(e) => { this.allowMeasureOverMaxiChange(e) }}
barSizeChange={(e) => { this.barSizeChange(e) }}
/>
</div>
)
}
colorSchemeChange(e) {
let value = e.target.value;
this.setState(() => ({ colorScheme: value }), () => { this.applyChanges() })
}
measureColorChange(e) {
let value = e.target.value;
this.setState(() => ({ measureColor: value }), () => { this.applyChanges() })
}
targetColorChange(e) {
let value = e.target.value;
this.setState(() => ({ targetColor: value }), () => { this.applyChanges() })
}
maxiColorChange(e) {
let value = e.target.value;
this.setState(() => ({ maxiColor: value }), () => { this.applyChanges() })
}
goodColorChange(e) {
let value = e.target.value;
this.setState(() => ({ goodColor: value }), () => { this.applyChanges() })
}
badColorChange(e) {
let value = e.target.value;
this.setState(() => ({ badColor: value }), () => { this.applyChanges() })
}
forecastColorChange(e) {
let value = e.target.value;
this.setState(() => ({ forecastColor: value }), () => { this.applyChanges() })
}
allowMeasureOverMaxiChange(e) {
let value = e.target.checked;
this.setState(() => ({ allowMeasureOverMaxi: value }), () => { this.applyChanges() })
}
barSizeChange(e) {
let value = e.target.value;
this.setState(() => ({ barSize: value }), () => { this.applyChanges() })
}
initHorizontalSparkline(sheet, name) {
sheet.suspendPaint();
sheet.name(name);
sheet.addSpan(1, 1, 1, 8);
sheet.getCell(1, 1).value("Revenue By Region (million $)")
.font("20px Calibri").hAlign(spreadNS.HorizontalAlign.center).vAlign(spreadNS.VerticalAlign.center)
.foreColor("white").backColor("#82bc00");
sheet.getRange(2, 1, 1, 8).vAlign(spreadNS.VerticalAlign.center)
.font("bold 16px Calibri")
.backColor("#F4F8EB");
sheet.getRange(3, 1, 6, 7).font("20px").vAlign(spreadNS.HorizontalAlign.center);
sheet.getRange(2, 1, 7, 8).setBorder(new GC.Spread.Sheets.LineBorder("Black", GC.Spread.Sheets.LineStyle.thin), {
all: true
});
sheet.getRange(3, 1, 6, 8).setBorder(new GC.Spread.Sheets.LineBorder("Black", GC.Spread.Sheets.LineStyle.dotted), {
inside: true
});
sheet.setArray(2, 2, [
['Region', 'Forecast', 'Actual', 'Target', 'Max', 'Optimist F.', 'Pessimist F.', ' '],
['North America', 80, 75, 70, 95, 65, 50],
['South America', 79, 62, 80, 95, 75, 50],
['Europe', 95, 100, 100, 120, 90, 80],
['Azia', 80, 95, 80, 90, 70, 55],
['Australia', 35, 20, 40, 50, 35, 15],
['Africa', 34, 40, 30, 50, 20, 15]
]);
for (var index = 3; index < 9; index++) {
sheet.setFormula(index, 1, '=BULLETSPARKLINE($E' + (index + 1) + ',' +
'$F' + (index + 1) + ',' +
'$G' + (index + 1) + ',' +
'$H' + (index + 1) + ',' +
'$I' + (index + 1) + ',' +
'$D' + (index + 1) + ',1,"#FFFFFF",false,"#000000","#F7A711","#DDDDDD","#BBBBBB","#999999","#FFFFFF",TRUE,0.7');
}
sheet.setRowHeight(1, 30);
for (var i = 3; i < 9; i++) {
sheet.setRowHeight(i, 40);
}
for (var j = 2; j < 9; j++) {
sheet.setColumnWidth(j, 100);
}
sheet.setColumnWidth(1, 250);
sheet.resumePaint();
}
initVerticalSparkline(sheet, name) {
sheet.suspendPaint();
sheet.name(name);
sheet.addSpan(1, 1, 1, 7);
sheet.getCell(1, 1).value("Revenue By Region (million $)")
.font("20px Calibri").hAlign(spreadNS.HorizontalAlign.center).vAlign(spreadNS.VerticalAlign.center)
.foreColor("white").backColor("#82bc00");
sheet.getRange(2, 1, 7, 1).vAlign(spreadNS.VerticalAlign.center)
.font("bold 16px Calibri")
.backColor("#F4F8EB");
sheet.getRange(2, 2, 7, 6).font("20px").vAlign(spreadNS.HorizontalAlign.center);
sheet.getRange(2, 1, 7, 7).setBorder(new GC.Spread.Sheets.LineBorder("Black", GC.Spread.Sheets.LineStyle.thin), {
all: true
});
sheet.getRange(2, 2, 7, 6).setBorder(new GC.Spread.Sheets.LineBorder("Black", GC.Spread.Sheets.LineStyle.dotted), {
inside: true
});
sheet.setArray(2, 1, [
['Region', 'North America', 'South America', 'Europe', 'Azia', 'Australia', 'Africa'],
['Forecast', 80, 79, 95, 80, 35, 34],
['Actual', 75, 62, 100, 95, 20, 40],
['Target', 70, 80, 100, 80, 40, 30],
['Max', 95, 95, 120, 90, 50, 50],
['Optimist F.', 65, 75, 90, 70, 35, 20],
['Pessimist F.', 50, 50, 80, 55, 15, 15]
]);
for (var index = 2; index < 8; index++) {
var columnChar = String.fromCharCode(65 + index);
sheet.setFormula(9, index, '=BULLETSPARKLINE($' + columnChar + '5,' +
'$' + columnChar + '6,' +
'$' + columnChar + '7,' +
'$' + columnChar + '8,' +
'$' + columnChar + '9,' +
'$' + columnChar + '4,1,"#FFFFFF",TRUE,"#000000","#F7A711","#DDDDDD","#BBBBBB","#999999","#FFFFFF",TRUE,0.7');
}
sheet.setRowHeight(1, 30);
sheet.setRowHeight(9, 200);
for (var j = 1; j < 8; j++) {
sheet.setColumnWidth(j, 100);
}
sheet.resumePaint();
}
applyChanges() {
let sheet = this.spread.getActiveSheet();
if (this.spread.getActiveSheetIndex() == 0) {
for (var index = 3; index < 9; index++) {
sheet.setFormula(index, 1, '=BULLETSPARKLINE($E' + (index + 1) + ',' +
'$F' + (index + 1) + ',' +
'$G' + (index + 1) + ',' +
'$H' + (index + 1) + ',' +
'$I' + (index + 1) + ',' +
'$D' + (index + 1) + ',1,"' +
this.state.colorScheme + '",false,"' +
this.state.measureColor + '","' +
this.state.targetColor + '","' +
this.state.maxiColor + '","' +
this.state.goodColor + '","' +
this.state.badColor + '","' +
this.state.forecastColor + '",' +
this.state.allowMeasureOverMaxi + ',' +
this.state.barSize);
}
} else if (this.spread.getActiveSheetIndex() == 1) {
for (var index = 2; index < 8; index++) {
var columnChar = String.fromCharCode(65 + index);
sheet.setFormula(9, index, '=BULLETSPARKLINE($' + columnChar + '5,' +
'$' + columnChar + '6,' +
'$' + columnChar + '7,' +
'$' + columnChar + '8,' +
'$' + columnChar + '9,' +
'$' + columnChar + '4,1,"' +
this.state.colorScheme + '",true,"' +
this.state.measureColor + '","' +
this.state.targetColor + '","' +
this.state.maxiColor + '","' +
this.state.goodColor + '","' +
this.state.badColor + '","' +
this.state.forecastColor + '",' +
this.state.allowMeasureOverMaxi + ',' +
this.state.barSize);
}
}
}
initSpread(spread) {
this.spread = spread;
this.initHorizontalSparkline(spread.sheets[0], "Horizontal");
this.initVerticalSparkline(spread.sheets[1], "Vertical");
}
}
const Panel = (props) => {
const { panelInfo, colorSchemeChange,
measureColorChange,
targetColorChange,
maxiColorChange,
goodColorChange,
badColorChange,
forecastColorChange,
allowMeasureOverMaxiChange,
barSizeChange } = props;
return (
<div class="options-container">
<div>
<label><b>Settings:</b></label>
</div>
<hr />
<div class="option-row">
<label for="color">Color Scheme:</label>
<select id="color" value={panelInfo.colorScheme + ""} onChange={(e) => { colorSchemeChange(e) }} >
<option value="#FFFFFF" selected>White</option>
<option value="#000000">Black</option>
<option value="#F7A711">Orange</option>
<option value="#DDDDDD">LightGrey</option>
<option value="#BBBBBB">Grey</option>
<option value="#999999">DarkGrey</option>
<option value="#82BC00">Green</option>
</select>
</div>
<div class="option-row">
<label for="measure">Measure Color:</label>
<select id="measure" value={panelInfo.measureColor + ""} onChange={(e) => { measureColorChange(e) }} >
<option value="#FFFFFF">White</option>
<option value="#000000" selected>Black</option>
<option value="#F7A711">Orange</option>
<option value="#DDDDDD">LightGrey</option>
<option value="#BBBBBB">Grey</option>
<option value="#999999">DarkGrey</option>
<option value="#82BC00">Green</option>
</select>
</div>
<div class="option-row">
<label for="target">Target Color:</label>
<select id="target" value={panelInfo.targetColor + ""} onChange={(e) => { targetColorChange(e) }} >
<option value="#FFFFFF">White</option>
<option value="#000000">Black</option>
<option value="#F7A711" selected>Orange</option>
<option value="#DDDDDD">LightGrey</option>
<option value="#BBBBBB">Grey</option>
<option value="#999999">DarkGrey</option>
<option value="#82BC00">Green</option>
</select>
</div>
<div class="option-row">
<label for="maxi">Maximum Color:</label>
<select id="maxi" value={panelInfo.maxiColor + ""} onChange={(e) => { maxiColorChange(e) }} >
<option value="#FFFFFF">White</option>
<option value="#000000">Black</option>
<option value="#F7A711">Orange</option>
<option value="#DDDDDD" selected>LightGrey</option>
<option value="#BBBBBB">Grey</option>
<option value="#999999">DarkGrey</option>
<option value="#82BC00">Green</option>
</select>
</div>
<div class="option-row">
<label for="good">Optimist Color:</label>
<select id="good" value={panelInfo.goodColor + ""} onChange={(e) => { goodColorChange(e) }} >
<option value="#FFFFFF">White</option>
<option value="#000000">Black</option>
<option value="#F7A711">Orange</option>
<option value="#DDDDDD">LightGrey</option>
<option value="#BBBBBB" selected>Grey</option>
<option value="#999999">DarkGrey</option>
<option value="#82BC00">Green</option>
</select>
</div>
<div class="option-row">
<label for="bad">Pessimist Color:</label>
<select id="bad" value={panelInfo.badColor + ""} onChange={(e) => { badColorChange(e) }} >
<option value="#FFFFFF">White</option>
<option value="#000000">Black</option>
<option value="#F7A711">Orange</option>
<option value="#DDDDDD">LightGrey</option>
<option value="#BBBBBB">Grey</option>
<option value="#999999" selected>DarkGrey</option>
<option value="#82BC00">Green</option>
</select>
</div>
<div class="option-row">
<label for="forecast">Forecast Color:</label>
<select id="forecast" value={panelInfo.forecastColor + ""} onChange={(e) => { forecastColorChange(e) }} >
<option value="#FFFFFF" selected>White</option>
<option value="#000000">Black</option>
<option value="#F7A711">Orange</option>
<option value="#DDDDDD">LightGrey</option>
<option value="#BBBBBB">Grey</option>
<option value="#999999">DarkGrey</option>
<option value="#82BC00">Green</option>
</select>
</div>
<div >
<input type="checkbox" id="allowMeasure" value={panelInfo.allowMeasureOverMaxi + ""} onClick={(e) => { allowMeasureOverMaxiChange(e) }} defaultChecked="true" />
<label for="allowMeasure">Allow Measure Over Max</label>
</div>
<div class="option-row">
<label for="size">Bar Size:</label>
<input type="text" id="size" value={panelInfo.barSize + ""} onChange={(e) => { barSizeChange(e) }} />
</div>
</div>
)
}
<!doctype html>
<html style="height:100%;font-size:14px;">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" type="text/css" href="$DEMOROOT$/en/react/node_modules/@mescius/spread-sheets/styles/gc.spread.sheets.excel2013white.css">
<!-- SystemJS -->
<script src="$DEMOROOT$/en/react/node_modules/systemjs/dist/system.src.js"></script>
<script src="systemjs.config.js"></script>
<script>
System.import('$DEMOROOT$/en/lib/react/license.js').then(function () {
System.import('./src/app');
});
</script>
</head>
<body>
<div id="app" style="height: 100%;"></div>
</body>
</html>
.sample {
position: relative;
height: 100%;
overflow: auto;
}
.sample::after {
display: block;
content: "";
clear: both;
}
.sample-tutorial {
position: relative;
height: 100%;
overflow: hidden;
}
.sample-spreadsheets {
width: calc(100% - 280px);
height: 100%;
overflow: hidden;
float: left;
}
.options-container {
float: right;
width: 280px;
padding: 12px;
height: 100%;
box-sizing: border-box;
background: #fbfbfb;
overflow: auto;
}
.option-row {
font-size: 14px;
padding: 5px;
margin-top: 10px;
}
.option-group {
margin-bottom: 6px;
}
label {
display: inline-block;
min-width: 90px;
margin-bottom: 6px;
}
select {
padding: 4px 6px;
box-sizing: border-box;
}
body {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
(function (global) {
System.config({
transpiler: 'plugin-babel',
babelOptions: {
es2015: true,
react: true
},
meta: {
'*.css': { loader: 'css' }
},
paths: {
// paths serve as alias
'npm:': 'node_modules/'
},
// map tells the System loader where to look for things
map: {
'@mescius/spread-sheets': 'npm:@mescius/spread-sheets/index.js',
'@mescius/spread-sheets-react': 'npm:@mescius/spread-sheets-react/index.js',
'@grapecity/jsob-test-dependency-package/react-components': 'npm:@grapecity/jsob-test-dependency-package/react-components/index.js',
'react': 'npm:react/cjs/react.production.js',
'react-dom': 'npm:react-dom/cjs/react-dom.production.js',
'react-dom/client': 'npm:react-dom/cjs/react-dom-client.production.js',
'scheduler': 'npm:scheduler/cjs/scheduler.production.js',
'css': 'npm:systemjs-plugin-css/css.js',
'plugin-babel': 'npm:systemjs-plugin-babel/plugin-babel.js',
'systemjs-babel-build':'npm:systemjs-plugin-babel/systemjs-babel-browser.js'
},
// packages tells the System loader how to load when no filename and/or no extension
packages: {
src: {
defaultExtension: 'jsx'
},
"node_modules": {
defaultExtension: 'js'
},
}
});
})(this);