I applied alpha color to FastLineRenderableSeries, but it was not visible. On the other hand, FastColumnRenderableSeries works well with alpha color. Please check the issue.
Example Code
class AlphaChart {
private val colorAlpha00 = ColorUtil.argb(0x00, 0xFF, 0xCC, 0x80) // 0%
private val colorAlpha1A = ColorUtil.argb(0x1A, 0xFF, 0xCC, 0x80) // 10%
private val colorAlpha33 = ColorUtil.argb(0x33, 0xFF, 0xCC, 0x80) // 20%
private val colorAlpha4D = ColorUtil.argb(0x4D, 0xFF, 0xCC, 0x80) // 30%
private val colorAlpha66 = ColorUtil.argb(0x66, 0xFF, 0xCC, 0x80) // 40%
private val colorAlpha80 = ColorUtil.argb(0x80, 0xFF, 0xCC, 0x80) // 50%
private val colorAlpha99 = ColorUtil.argb(0x99, 0xFF, 0xCC, 0x80) // 60%
private val colorAlphaB3 = ColorUtil.argb(0xB3, 0xFF, 0xCC, 0x80) // 70%
private val colorAlphaCC = ColorUtil.argb(0xCC, 0xFF, 0xCC, 0x80) // 80%
private val colorAlphaE6 = ColorUtil.argb(0xE6, 0xFF, 0xCC, 0x80) // 90%
private val colorAlphaFF = ColorUtil.argb(0xFF, 0xFF, 0xCC, 0x80) // 100%
fun initAlphaChart(surface: SciChartSurface) {
surface.suspendUpdates {
theme = R.style.SciChart_Alpha
xAxes {
numericAxis {
autoRange = AutoRange.Always
growBy = DoubleRange(0.1, 0.1)
}
}
yAxes {
numericAxis {
autoRange = AutoRange.Always
growBy = DoubleRange(0.2, 0.2)
}
}
renderableSeries {
fastColumnRenderableSeries {
dataSeries = createDataSeries(2.0)
paletteProvider = AlphaPaletteProvider()
}
fastLineRenderableSeries {
dataSeries = createDataSeries(3.0)
strokeStyle = SolidPenStyle(colorAlpha00, 2f) // 0% - Not Visible
}
fastLineRenderableSeries {
dataSeries = createDataSeries(3.1)
strokeStyle = SolidPenStyle(colorAlpha1A, 2f) // 10% - Not Visible
}
fastLineRenderableSeries {
dataSeries = createDataSeries(3.2)
strokeStyle = SolidPenStyle(colorAlpha33, 2f) // 20% - Not Visible
}
fastLineRenderableSeries {
dataSeries = createDataSeries(3.3)
strokeStyle = SolidPenStyle(colorAlpha4D, 2f) // 30% - Not Visible
}
fastLineRenderableSeries {
dataSeries = createDataSeries(3.4)
strokeStyle = SolidPenStyle(colorAlpha66, 2f) // 40% - Not Visible
}
fastLineRenderableSeries {
dataSeries = createDataSeries(3.5)
strokeStyle = SolidPenStyle(colorAlpha80, 2f) // 50% - Not Visible
}
fastLineRenderableSeries {
dataSeries = createDataSeries(3.6)
strokeStyle = SolidPenStyle(colorAlpha99, 2f) // 60% - Not Visible
}
fastLineRenderableSeries {
dataSeries = createDataSeries(3.7)
strokeStyle = SolidPenStyle(colorAlphaB3, 2f) // 70%
}
fastLineRenderableSeries {
dataSeries = createDataSeries(3.8)
strokeStyle = SolidPenStyle(colorAlphaCC, 2f) // 80%
}
fastLineRenderableSeries {
dataSeries = createDataSeries(3.9)
strokeStyle = SolidPenStyle(colorAlphaE6, 2f) // 90%
}
fastLineRenderableSeries {
dataSeries = createDataSeries(4.0)
strokeStyle = SolidPenStyle(colorAlphaFF, 2f) // 100%
}
}
chartModifiers {
rolloverModifier {}
}
}
}
private fun createDataSeries(yValues: Double): XyDataSeries<Int, Double> {
return XyDataSeries<Int, Double>().apply {
for (index in 1..10) {
append(index, yValues)
}
}
}
}
class AlphaPaletteProvider :
PaletteProviderBase<FastColumnRenderableSeries>(FastColumnRenderableSeries::class.java),
IFillPaletteProvider, IStrokePaletteProvider {
private val colorAlpha00 = ColorUtil.argb(0x00, 0xFF, 0xCC, 0x80) // 0%
private val colorAlpha1A = ColorUtil.argb(0x1A, 0xFF, 0xCC, 0x80) // 10%
private val colorAlpha33 = ColorUtil.argb(0x33, 0xFF, 0xCC, 0x80) // 20%
private val colorAlpha4D = ColorUtil.argb(0x4D, 0xFF, 0xCC, 0x80) // 30%
private val colorAlpha66 = ColorUtil.argb(0x66, 0xFF, 0xCC, 0x80) // 40%
private val colorAlpha80 = ColorUtil.argb(0x80, 0xFF, 0xCC, 0x80) // 50%
private val colorAlpha99 = ColorUtil.argb(0x99, 0xFF, 0xCC, 0x80) // 60%
private val colorAlphaB3 = ColorUtil.argb(0xB3, 0xFF, 0xCC, 0x80) // 70%
private val colorAlphaCC = ColorUtil.argb(0xCC, 0xFF, 0xCC, 0x80) // 80%
private val colorAlphaE6 = ColorUtil.argb(0xE6, 0xFF, 0xCC, 0x80) // 90%
private val colorAlphaFF = ColorUtil.argb(0xFF, 0xFF, 0xCC, 0x80) // 100%
private val colors = IntegerValues(
intArrayOf(
colorAlpha00,
colorAlpha1A,
colorAlpha33,
colorAlpha4D,
colorAlpha66,
colorAlpha80,
colorAlpha99,
colorAlphaB3,
colorAlphaCC,
colorAlphaE6,
colorAlphaFF
)
)
override fun update() {}
override fun getFillColors(): IntegerValues = colors
override fun getStrokeColors(): IntegerValues = colors
}
- Jeong HaMin asked 2 months ago
- last edited 2 months ago
-
When the background color is white (0xFFFFFF), colors with low Alpha values appear very blurred or invisible in FastLineRenderableSeries. On the other hand, FastColumRenderableSeries shows clearly well even in colors with low alpha values. Please check again.
- You must login to post comments
When the background color is white (0xFFFFFF), colors with low Alpha values appear very blurred or invisible in FastLineRenderableSeries. On the other hand, FastColumRenderableSeries shows clearly well even in colors with low alpha values. Please check again.
- Jeong HaMin answered 2 months ago
- You must login to post comments
Hi,
I tried the same code above provided, but I am unable to reproduce the issue.
Can you please share screenshot of your result.
Here is the screenshot of my result.
- Maulik Senghani answered 2 months ago
- last edited 2 months ago
- You must login to post comments
Please login first to submit.