Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bar chart bar value outline #4432

Open
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

bivant
Copy link
Contributor

@bivant bivant commented Jul 31, 2020

Goals ⚽

BarChart - add ability to imitate bar shadows by outlines. An outline has a color and size (insets).
Example: BarChart_outilne

Implementation Details 🚧

IBarChartDataSet.swift - BarChartBarValueOutline

@objc open class BarChartBarValueOutline: NSObject
{
    @objc public var color: NSUIColor
    @objc public var insets: NSUIEdgeInsets
}

Do not draw the outlines if result bar width/height is less than 1. Stop drawing on the last outline that precedes that condition.
Value bar is a rect inside the outlines.
Border is drawn inside the outlines.

Testing Details 🔍

Tests for the narrow and wide bars are added. With and without the value labels.
Stacked bar test + same with value bar border.

The color and insets can be adjusted so shadow effect (of the value bar) can be simulated if needed
…ix objc compilation error (BarChartBarValueOutline)

Stop drawing on the last outline that precedes that condition. Add additive operator to the NSUIEdgeInsets.
@bivant
Copy link
Contributor Author

bivant commented Jul 31, 2020

CI failed - strange, xCode Version 11.6 (11E708) is able to compile the changes without any issues. Objc, Swift and Mac.

@bivant
Copy link
Contributor Author

bivant commented Dec 14, 2020

Hello.
CI is broken because of the tests. At the moment need to add "EXCLUDED_ARCHS[sdk=*]" = arm64; in the project settings to build tests locally. Additionally seems like reference screenshots are "broken", almost all tests fail even without my changes (master branch)

@4np
Copy link
Contributor

4np commented Dec 15, 2020

This would be easy to accomplish by creating a custom renderer if #4297 was merged.

# Conflicts:
#	Charts.xcodeproj/project.pbxproj
@4np 4np mentioned this pull request Jan 29, 2021
…issing architecture build error by enabling build active arch only in debug.

# Conflicts:
#	Tests/ChartsTests/__Snapshots__x86__/BarChartTests/testOutlinesNarrowValues_iOS_375_0_667_0@2x.png
#	Tests/ChartsTests/__Snapshots__x86__/BarChartTests/testOutlinesNarrowValues_tvOS_1920_0_1080_0@1x.png
#	Tests/ChartsTests/__Snapshots__x86__/BarChartTests/testOutlinesNarrow_iOS_375_0_667_0@2x.png
#	Tests/ChartsTests/__Snapshots__x86__/BarChartTests/testOutlinesNarrow_tvOS_1920_0_1080_0@1x.png
#	Tests/ChartsTests/__Snapshots__x86__/BarChartTests/testOutlinesStackedBordered_iOS_375_0_667_0@2x.png
#	Tests/ChartsTests/__Snapshots__x86__/BarChartTests/testOutlinesStackedBordered_tvOS_1920_0_1080_0@1x.png
#	Tests/ChartsTests/__Snapshots__x86__/BarChartTests/testOutlinesStacked_iOS_375_0_667_0@2x.png
#	Tests/ChartsTests/__Snapshots__x86__/BarChartTests/testOutlinesStacked_tvOS_1920_0_1080_0@1x.png
#	Tests/ChartsTests/__Snapshots__x86__/BarChartTests/testOutlinesWideValues_iOS_375_0_667_0@2x.png
#	Tests/ChartsTests/__Snapshots__x86__/BarChartTests/testOutlinesWideValues_tvOS_1920_0_1080_0@1x.png
#	Tests/ChartsTests/__Snapshots__x86__/BarChartTests/testOutlinesWide_iOS_375_0_667_0@2x.png
#	Tests/ChartsTests/__Snapshots__x86__/BarChartTests/testOutlinesWide_tvOS_1920_0_1080_0@1x.png
# Conflicts:
#	Source/Charts/Renderers/BarChartRenderer.swift
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants