Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions examples/CorePlotGallery/Plot Gallery-Mac/PlotViewItem.xib
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="15702" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="19162" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="15702"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="19162"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
Expand Down
5 changes: 5 additions & 0 deletions framework/Source/CPTAxis.m
Original file line number Diff line number Diff line change
Expand Up @@ -1034,6 +1034,10 @@ -(void)autoGenerateMajorTickLocations:(CPTNumberSet *__autoreleasing *)newMajorL
case CPTScaleTypeLinear:
// supported scale type
break;

case CPTScaleTypeSkew:
// supported scale type
break;

case CPTScaleTypeLog:
// supported scale type--check range
Expand Down Expand Up @@ -1066,6 +1070,7 @@ -(void)autoGenerateMajorTickLocations:(CPTNumberSet *__autoreleasing *)newMajorL
// Filter troublesome values and return empty sets
if ((length != 0.0) && !isinf(length)) {
switch ( scaleType ) {
case CPTScaleTypeSkew:
case CPTScaleTypeLinear:
{
// Determine interval value
Expand Down
1 change: 1 addition & 0 deletions framework/Source/CPTDefinitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ typedef NS_ENUM (NSInteger, CPTErrorBarType) {
**/
typedef NS_ENUM (NSInteger, CPTScaleType) {
CPTScaleTypeLinear, ///< Linear axis scale
CPTScaleTypeSkew, ///< Linear axis scale that is skewed relative to orthogonal coordinate
CPTScaleTypeLog, ///< Logarithmic axis scale
CPTScaleTypeAngular, ///< Angular axis scale (not implemented)
CPTScaleTypeDateTime, ///< Date/time axis scale (not implemented)
Expand Down
2 changes: 2 additions & 0 deletions framework/Source/CPTPlot.m
Original file line number Diff line number Diff line change
Expand Up @@ -986,6 +986,7 @@ -(void)cacheNumbers:(nullable id)numbers forField:(NSUInteger)fieldEnum
if ( numbers ) {
switch ( [thePlotSpace scaleTypeForCoordinate:coordinate] ) {
case CPTScaleTypeLinear:
case CPTScaleTypeSkew:
case CPTScaleTypeLog:
case CPTScaleTypeLogModulus:
{
Expand Down Expand Up @@ -1082,6 +1083,7 @@ -(void)cacheNumbers:(nullable id)numbers forField:(NSUInteger)fieldEnum atRecord

switch ( [thePlotSpace scaleTypeForCoordinate:coordinate] ) {
case CPTScaleTypeLinear:
case CPTScaleTypeSkew:
case CPTScaleTypeLog:
case CPTScaleTypeLogModulus:
{
Expand Down
18 changes: 16 additions & 2 deletions framework/Source/CPTXYAxis.m
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ -(void)drawGridLinesInContext:(nonnull CGContextRef)context isMajor:(BOOL)major

[self relabel];

CPTPlotSpace *thePlotSpace = self.plotSpace;
CPTXYPlotSpace *thePlotSpace = (CPTXYPlotSpace *)self.plotSpace;
CPTNumberSet *locations = (major ? self.majorTickLocations : self.minorTickLocations);
CPTCoordinate selfCoordinate = self.coordinate;
CPTCoordinate orthogonalCoordinate = CPTOrthogonalCoordinate(selfCoordinate);
Expand Down Expand Up @@ -457,7 +457,11 @@ -(void)drawGridLinesInContext:(nonnull CGContextRef)context isMajor:(BOOL)major
for ( NSDecimalNumber *location in locations ) {
NSDecimal locationDecimal = location.decimalValue;

if ( labeledRange && ![labeledRange contains:locationDecimal] ) {
// In the case of a skewed X plot space range, we will be providing the tick locations.
// Because of this, we don't want to mask out the tick locations without labels. Keep
// the labeled locations AND the skew lines that come from out of frame.
if ( labeledRange && ![labeledRange contains:locationDecimal] &&
!(thePlotSpace.xScaleType == CPTScaleTypeSkew) && !(self.coordinate == CPTCoordinateX)) {
continue;
}

Expand All @@ -468,6 +472,15 @@ -(void)drawGridLinesInContext:(nonnull CGContextRef)context isMajor:(BOOL)major
CGPoint startViewPoint = [thePlotSpace plotAreaViewPointForPlotPoint:startPlotPoint numberOfCoordinates:2];
startViewPoint.x += originTransformed.x;
startViewPoint.y += originTransformed.y;

// In the case of a skewed coordinate axis system, the Y axis lines will not connect with the origin
// but instead only connect to the minimum slanted X axis line. This says to connect Y axis grid lines
// all the way to the left hand side.
if (thePlotSpace.xScaleType == CPTScaleTypeSkew) {
if (self.coordinate == CPTCoordinateY) {
startViewPoint.x = 0;
}
}

// End point
CGPoint endViewPoint = [thePlotSpace plotAreaViewPointForPlotPoint:endPlotPoint numberOfCoordinates:2];
Expand Down Expand Up @@ -817,6 +830,7 @@ -(nonnull NSNumber *)defaultTitleLocation
CPTScaleType scaleType = [thePlotSpace scaleTypeForCoordinate:theCoordinate];

switch ( scaleType ) {
case CPTScaleTypeSkew:
case CPTScaleTypeLinear:
location = axisRange.midPoint;
break;
Expand Down
1 change: 1 addition & 0 deletions framework/Source/CPTXYPlotSpace.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
@property (nonatomic, readwrite, copy, nonnull) CPTPlotRange *yRange;
@property (nonatomic, readwrite, copy, nullable) CPTPlotRange *globalXRange;
@property (nonatomic, readwrite, copy, nullable) CPTPlotRange *globalYRange;
@property (nonatomic, readwrite) double skewAngle;
@property (nonatomic, readwrite, assign) CPTScaleType xScaleType;
@property (nonatomic, readwrite, assign) CPTScaleType yScaleType;

Expand Down
Loading