show legend on PieChart - kotlin

im trying to display my data on Piechart on my Kotlin app using EazeGraph library
EazeGraph
i want when i click on slice ( or display it automatically ) it display to me the data of this slice in a legend or text
kotlin code
pieChart.addPieSlice(
PieModel(
"All Members",
stats.countAllmembers!!.toFloat(),
Color.parseColor("#EF5350"),
),
)
pieChart.isEnabled = true
pieChart.startAnimation()

Related

I am struggling to get a customized hovertemplate on plotly parcats chart

So I tried to put hovertemplate inside go.Parcats but not sure which way to put it. I want something like when you hover on any line it shuold show the custom discription like names of attributes and count and percentage on hover.
Also is there any wat to blank out those labels at the bottom of the chart so that it looks less busy and nicer but also when you hover on it shuold show up details. I know it's too much of customization but hoping it's doable.
dimensions.append(dict(values = df[dim], label = dim, categoryarray = df[dim].unique(), categoryorder = 'array', ticktext = slabel))
fig = go.Figure(data = [go.Parcats(dimensions= dimensions,
line = {'color': color, 'colorscale':colorscale,},
)]
)

react native handle a word in text

I want when I touch a word inside a text component get that word an handle it , for example console.log(SelectedWord)
There is react-native-selectable-text library , but this library change native copy paste function and work with longPress word in text
sample code :
import { SelectableText } from "#alentoma/react-native-selectable-text";
// Use normally, it is a drop-in replacement for react-native/Text
<SelectableText
menuItems={["Foo", "Bar"]}
/*
Called when the user taps in a item of the selection menu:
- eventType: (string) is the label
- content: (string) the selected text portion
- selectionStart: (int) is the start position of the selected text
- selectionEnd: (int) is the end position of the selected text
*/
onSelection={({ eventType, content, selectionStart, selectionEnd }) => {}}
value="I crave star damage"
/>;
how can I handle word in text with touch? not longPress and change native copy paste function
and I do not want split text to words an return many text component Because it slows down the loading of the screen very much

Shiny Dashboard Inputs inside MenuItems Problems

I am new to shiny dashboards and I am trying my hand at making a simple dashboard. I am trying to put together a dashboard that will basically go through different clustering algorithms and show how they work.
I have a menu item for the overall branching topic, and then input items within those menus that specify the parameters for the clustering algorithms.
My issue is I cannot get any output on my screen. I cannot render plots of even see the title for the boxes that I placed inside the tabItems. This seems to happen when I place a sub-item inside one of my menu items. I am not sure why.
Attached is my ui.R script and server.R script.
ui.R file:
server.R file:
Any help with this matter would be much appreciated.
So, as far as I can see, the problem is due to the fact that you placed the radioButtons within the menuItem. If you want to only show the radioButtons when the tab kclustering is active, you need to wrap radioButtons in a conditionalPanel. It would look something like that:
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(title = "Bla"),
dashboardSidebar(
sidebarMenu(
id = "tabs",
menuItem(
"K-clustering",
tabName = "kclustering",
icon = icon("cogs")),
conditionalPanel(
"input.tabs == 'kclustering'",
radioButtons("technique", "Technique Choice",
c("K-Means" = "kmeans",
"K-Medians" = "kmedians",
"K-Medoids" = "kmedoids"),
select = "kmedians")
),
menuItem("DBSCAN", tabName = "dbscan")
)
),
dashboardBody(
tabItems(
tabItem("kclustering",
fluidRow(
box(plotOutput("step1"))
))
)
))
server <- function(input, output) {
output$step1 <- renderPlot({
hist(rnorm(5000))
})
}
runApp(shinyApp(ui, server))
In this case, it's important to set the id argument of the sidebarMenu object to be able to formulate your condition.
Bottom line is: don't put your radioButtons, sliderInput and textInput inside the menuItem objects but in the sidebarMenu object itself.

Percentage is not showing in Dojo Pie Chart?

After applying text values in dojo pie chart , I am unable to see percentage in the slice. But without text values, its showing as percentage as default. How can I get both text and percentage?
chartData.push({
y : count,
text:"My Label1",
tooltip : "My Label1 : " + count,
color : "blue"
});
Yes but unfortunately then you need to compute it yourself and add it to the text it won't be automatic anymore. Something like the following:
chartData.push({
// ...
text: "My Labels1: "+(value/total)+"%"
});

Possible to draw to canvas element in a dynamically created document?

I'm writing some javascript for a Windows 8 app. I'm trying to render a drawing to a canvas element that is a child of a dynamically created document.
I've got this function returning a new document:
initPrintDoc: function () {
var emptyDoc = document.implementation.createDocument('http://www.w3.org/1999/xhtml', 'html', null),
emptyBody = document.createElement('body'),
emptyCanvas = document.createElement('canvas'),
debugDiv = document.createElement('div'),
debugMsg = document.createTextNode("[PRINT] : This is a test print source.");
//Initialize attributes for elements
emptyBody.setAttribute('id', 'pdf-container');
emptyCanvas.setAttribute('id', 'render-output');
debugDiv.setAttribute('id', 'debug-output');
debugDiv.appendChild(debugMsg);
emptyBody.appendChild(debugDiv);
emptyBody.appendChild(emptyCanvas);
emptyDoc.documentElement.appendChild(emptyBody);
return emptyDoc;
},
The returned document object is not the document object that is displayed in the Windows 8 App UI at runtime. I am using this dynamically created document as the parameter for the MSApp.getHtmlPrintDocumentSource(). Unfortunately, no matter what I do to the canvas element that is inside this document, the canvas never shows a rendering in the actual printout, nor in the simple preview window found in the charms bar after clicking a selected printer.
My question is: does a canvas element require its container document to be displayed in the browser window? Can you manipulate a canvas element in a dynamically created document, and expect those manipulations to show when you display that document?