Commit d2ea179e authored by David Anderson's avatar David Anderson
Browse files

axis can never have a margin smaller than chartMargin

parent 7532ed2c
......@@ -31,6 +31,8 @@ export class BoxplotDemoComponent {
ngAfterViewInit() {
let me = this;
me.chart = new ChartCanvas( me.drawSpace.nativeElement );
let primaryAxis, secondaryAxis;
if ( isVertical ) {
primaryAxis = new ContinuousAxis( 'left' );
......@@ -40,17 +42,27 @@ export class BoxplotDemoComponent {
secondaryAxis = isCategorical ? new CategoricalAxis<number>( 'left' ) : new ContinuousAxis( 'left' );
}
let boxPlot = new BoxPlot();
boxPlot.primaryAxis = primaryAxis;
boxPlot.secondaryAxis = secondaryAxis;
let scatterChart = new ScatterChart();
boxPlot.margin = scatterChart.margin = 20;
me.chart.background = '#ccc';
boxPlot.background = '#333';
me.chart.debugLogger.isEnabled = true;
scatterChart.shouldCenterBandY = true;
if ( !isCategorical ) {
boxPlot.shouldCenterBandY = true;
secondaryAxis.color = primaryAxis.color = 'steelblue';
if ( !isCategorical ) {
boxPlot.shouldCenterBandY = true;
boxPlot.getBandThickness = () => {
return 20;
};
......@@ -65,7 +77,6 @@ export class BoxplotDemoComponent {
}
me.chart = new ChartCanvas( me.drawSpace.nativeElement );
me.chart.addBehavior( new GetDataAtMouseEvent(
'click',
{
......
......@@ -570,7 +570,7 @@ export class ChartCanvas {
chartMargin = Math.max( chartMargin, chart.margin );
} );
let axisMargin = new TBLR( 0 );
let axisMargin = new TBLR( chartMargin );
this.axisList.forEach( axis => {
tmp = axis._implementation.getMinMargin();
axisMargin.top = Math.max( axisMargin.top, tmp.top );
......
......@@ -22,12 +22,12 @@ export class BoxPlotImplementation extends BaseChartImplementation {
let primaryAxis = me.chart.primaryAxis as BaseAxis;
let secondaryAxis = me.chart.secondaryAxis as BaseAxis;
let margin = me.chart.margin;
//define the width of the box
let bandValue = secondaryAxis.getValue( plot );
let bandStart = me.valueToPx( secondaryAxis, bandValue ) + margin;
let bandWidth = me.chart.getBandThickness( plot );
let bandStart = me.valueToPx( secondaryAxis, bandValue )
if( secondaryAxis._implementation.isVertical && me.chart.shouldCenterBandY ){
bandStart -= bandWidth /2;
}
......@@ -36,11 +36,11 @@ export class BoxPlotImplementation extends BaseChartImplementation {
}
let ret: ProcessedBoxData = {
boxPixels: {
median: me.valueToPx( primaryAxis, primaryAxis.getValue(plot.median ) ),
lowerLimit: me.valueToPx( primaryAxis, primaryAxis.getValue(plot.limitMin ) ),
higherLimit: me.valueToPx( primaryAxis, primaryAxis.getValue(plot.limitMax ) ),
boxStart: me.valueToPx( primaryAxis, primaryAxis.getValue(plot.boxMin ) ),
boxEnd: me.valueToPx( primaryAxis, primaryAxis.getValue(plot.boxMax) )
median: me.valueToPx( primaryAxis, primaryAxis.getValue(plot.median ) + margin ),
lowerLimit: me.valueToPx( primaryAxis, primaryAxis.getValue(plot.limitMin ) + margin ),
higherLimit: me.valueToPx( primaryAxis, primaryAxis.getValue(plot.limitMax ) + margin ),
boxStart: me.valueToPx( primaryAxis, primaryAxis.getValue(plot.boxMin ) + margin ),
boxEnd: me.valueToPx( primaryAxis, primaryAxis.getValue(plot.boxMax) + margin )
},
bandPixels: {
bandStart: bandStart,
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment