Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreiKingsley committed Jul 21, 2023
2 parents 4ccfdd2 + 0aad2e3 commit 6c03afa
Show file tree
Hide file tree
Showing 4 changed files with 136 additions and 3 deletions.
10 changes: 10 additions & 0 deletions .github/ISSUE_TEMPLATE/blank-issue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
name: Blank issue
about: Create a issue to help us improve kandy library
title: ''
labels: ''
assignees: ''

---


36 changes: 36 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
name: Bug report
about: Create a report to help us improve kandy library
title: "[BUG]"
labels: bug
assignees: ''

---

## **Describe the bug**
Please provide a description of the bug, including steps to reproduce it and the expected result.

## **To Reproduce**
Steps to reproduce the behavior:
1. Prepare the data
2. Create the chart using the library
3. Customize the chart
4. Render or display the plot
5. Interact with the plot (if applicable)

## **Expected behavior**
Describe how the functionality should work without the bug.

## **Actual Behavior**
Describe what is actually happening, including any error messages or stack traces.

## **Screenshots**
if applicable

## **Library Version, Tool version, and Environment**
(please complete the following information):
- Library version:
- Kotlin-Notebook version: (or kotlin-jupyter-kernel if you are using jupyter or Datalore)

## **Additional information**
Provide any other useful information that may help in resolving the bug.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
kotlin.code.style=official
kotlin.jupyter.add.scanner=true
version=0.4.3
version=0.4.4
# Koltin
systemProp.kotlin_version=1.8.20
systemProp.dokka_version=1.8.10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
package org.jetbrains.kotlinx.kandy.dsl.internal

import org.jetbrains.kotlinx.dataframe.DataColumn
import org.jetbrains.kotlinx.dataframe.DataFrame
import org.jetbrains.kotlinx.kandy.ir.Layer
import org.jetbrains.kotlinx.kandy.ir.Plot
import org.jetbrains.kotlinx.kandy.ir.aes.AesName
import org.jetbrains.kotlinx.kandy.ir.bindings.*
import org.jetbrains.kotlinx.kandy.ir.data.NamedData
import org.jetbrains.kotlinx.kandy.ir.feature.FeatureName
import org.jetbrains.kotlinx.kandy.ir.feature.LayerFeature
import org.jetbrains.kotlinx.kandy.ir.feature.PlotFeature
Expand Down Expand Up @@ -50,10 +52,95 @@ public interface BaseContext {
*/
public abstract class LayerContext(parent: LayerCollectorContext) : BindingContext {
override val bindingCollector: BindingCollector = BindingCollector()
override val datasetIndex: Int = parent.datasetIndex
override var datasetIndex: Int = parent.datasetIndex
public val features: MutableMap<FeatureName, LayerFeature> = mutableMapOf()
override val plotContext: PlotContext = parent.plotContext
public abstract val requiredAes: Set<AesName>

private var firstMapping = true
private val handlerRowsCount: Int
get() {
val buffer = datasetHandler.buffer
return if (buffer == DataFrame.Empty) {
datasetHandler.initialNamedData.dataFrame.rowsCount()
} else {
buffer.rowsCount()
}
}

private fun overrideDataset() {
plotContext.datasetHandlers.add(DatasetHandler(NamedData(DataFrame.Empty)))
datasetIndex = plotContext.datasetHandlers.size - 1
}

override fun <DomainType, RangeType> addNonPositionalMapping(
aesName: AesName,
columnID: String,
parameters: NonPositionalMappingParameters<DomainType, RangeType>?
): NonPositionalMapping<DomainType, RangeType> {
firstMapping = false
return super.addNonPositionalMapping(aesName, columnID, parameters)
}

override fun <DomainType, RangeType> addNonPositionalMapping(
aesName: AesName,
values: DataColumn<DomainType>,
parameters: NonPositionalMappingParameters<DomainType, RangeType>?
): NonPositionalMapping<DomainType, RangeType> {
if (firstMapping && handlerRowsCount != values.size()) {
overrideDataset()
}
firstMapping = false
return super.addNonPositionalMapping(aesName, values, parameters)
}

override fun <DomainType, RangeType> addNonPositionalMapping(
aesName: AesName,
values: List<DomainType>,
name: String?,
parameters: NonPositionalMappingParameters<DomainType, RangeType>?
): NonPositionalMapping<DomainType, RangeType> {
if (firstMapping && handlerRowsCount != values.size) {
overrideDataset()
}
firstMapping = false
return super.addNonPositionalMapping(aesName, values, name, parameters)
}

override fun <DomainType> addPositionalMapping(
aesName: AesName,
columnID: String,
parameters: PositionalMappingParameters<DomainType>?
): PositionalMapping<DomainType> {
firstMapping = false
return super.addPositionalMapping(aesName, columnID, parameters)
}

override fun <DomainType> addPositionalMapping(
aesName: AesName,
values: DataColumn<DomainType>,
parameters: PositionalMappingParameters<DomainType>?
): PositionalMapping<DomainType> {
if (firstMapping && handlerRowsCount != values.size()) {
overrideDataset()
}
firstMapping = false
return super.addPositionalMapping(aesName, values, parameters)
}

override fun <DomainType> addPositionalMapping(
aesName: AesName,
values: List<DomainType>,
name: String?,
parameters: PositionalMappingParameters<DomainType>?
): PositionalMapping<DomainType> {
if (firstMapping && handlerRowsCount != values.size) {
overrideDataset()
}
firstMapping = false
return super.addPositionalMapping(aesName, values, name, parameters)
}

}

/**
Expand All @@ -77,7 +164,7 @@ public interface LayerCollectorContext : BaseContext {
} else null)
layers.add(
Layer(
datasetIndex,
context.datasetIndex,
geom,
context.bindingCollector.mappings,
context.bindingCollector.settings,
Expand Down

0 comments on commit 6c03afa

Please sign in to comment.