-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Set axes color and added AxesTextColor property #3316
base: ucr
Are you sure you want to change the base?
Changes from 2 commits
71b291d
c1c63ff
810581c
a2bc8c9
415bda0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,6 +47,7 @@ open class AxisChartView : ChartView { | |
(chart as? BarLineChartViewBase)?.leftAxis.granularity = 1 | ||
} | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please reset this file as mentioned. |
||
|
||
// sets whether the X origin should be fixed to 0 | ||
public func setXMinimum (zero: Bool) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,11 +52,14 @@ import DGCharts | |
var _gridEnabled = true | ||
var _labels = [String]() | ||
var _dataComponents: Array<ChartDataBase> = [] | ||
|
||
var _axesTextColor: UIColor | ||
|
||
@objc public override init(_ parent: ComponentContainer) { | ||
XFromZero = false | ||
YFromZero = false | ||
_backgroundColor = parent.form?.isDarkTheme == true ? UIColor.black : UIColor.white | ||
_backgroundColor = parent.form?.isDarkTheme == true ? UIColor.white : UIColor.black | ||
_axesTextColor = parent.form?.isDarkTheme == true ? UIColor.white : UIColor.black | ||
super.init(parent) | ||
setDelegate(self) | ||
parent.add(self) | ||
|
@@ -112,6 +115,21 @@ import DGCharts | |
_chartView?.backgroundColor = _backgroundColor | ||
} | ||
} | ||
|
||
@objc open var AxesTextColor: Int32 { | ||
get { | ||
return colorToArgb(_axesTextColor) | ||
} | ||
set { | ||
_axesTextColor = argbToColor(newValue) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make sure to appropriately handle if |
||
print("changing label color to") | ||
print(_axesTextColor) | ||
if let chartView = _chartView?.chart as? BarLineChartViewBase { | ||
chartView.xAxisRenderer.axis.labelTextColor = _axesTextColor | ||
chartView.leftYAxisRenderer.axis.labelTextColor = _axesTextColor | ||
} | ||
} | ||
} | ||
|
||
@objc open var Description: String { | ||
get { | ||
|
@@ -287,6 +305,8 @@ import DGCharts | |
Labels = _labels | ||
LegendEnabled = _legendEnabled | ||
PieRadius = _pieRadius | ||
|
||
AxesTextColor = colorToArgb(_axesTextColor) | ||
} | ||
|
||
func addDataComponent(_ dataComponent: ChartDataBase) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We will need to reset this since the change is already in ucr. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,8 @@ | |
import com.github.mikephil.charting.charts.BarLineChartBase; | ||
import com.github.mikephil.charting.data.BarLineScatterCandleBubbleData; | ||
import com.github.mikephil.charting.data.Entry; | ||
import com.github.mikephil.charting.renderer.XAxisRenderer; | ||
import com.github.mikephil.charting.renderer.YAxisRenderer; | ||
|
||
import com.github.mikephil.charting.interfaces.datasets.IBarLineScatterCandleBubbleDataSet; | ||
|
||
|
@@ -51,4 +53,14 @@ protected void initializeDefaultSettings() { | |
public View getView() { | ||
return chart; | ||
} | ||
/** | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Code style: Include a blank line before the Javadoc to visually separate it from the previous function body. |
||
* Sets the color of the axes text of the Point Chart. | ||
* | ||
* @param color color to set text to. | ||
*/ | ||
public void setAxesTextColor(int color){ | ||
System.out.println("the color is" + color); | ||
XAxisRenderer xAxisRenderer = chart.getRendererXAxis(); | ||
xAxisRenderer.getPaintAxisLabels().setColor(color); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably don't need an extra blank line.