Posted 15 November 2017, 8:33 am EST
Is there a way to format the flexchart (type bar) to different colors per bar. There is going to be criteria that will dictate which color it will be.
Currently I have this set up for item formatter and what it does is it doesn’t make a bar. It has the label on the screen but no bar
itemFormatter = (engine, hitTestInfo, defaultFormat) => {
console.log(engine, hitTestInfo, defaultFormat);
console.log('x', hitTestInfo.x);
console.log('series', hitTestInfo.series);
if (hitTestInfo.chartElement == wjcChart.ChartElement.Series) {
let item = hitTestInfo.item;
let series = hitTestInfo.series;
let pi = hitTestInfo.pointIndex;
console.log('pi', pi);
if( pi > 0) {
let xvals = series.getValues(1);
// previous data point
let prevX = xvals ? xvals[pi - 1] : pi - 1;
let prevY = series.getValues(0)[pi - 1];
// convert to pixel coordinates
let pt1 = this.chart.dataToPoint( hitTestInfo.x, hitTestInfo.y);
// let pt2 = this.chart.dataToPoint( prevX, prevY);
// draw lines
// console.log()
engine.drawLine( hitTestInfo.point.x, hitTestInfo.point.y, pt1.x, pt1.y);
// engine.drawLine( pt1.x, pt1.y, pt2.x, pt2.y);
// engine.drawLine( pt1.x, pt1.y);
}
// draw default symbol\
console.log('defaultFormat',defaultFormat);
defaultFormat();
}
};