I am now using the MPAndroidChart to draw line chartmy chart
As you can see from the above screenshot, the color specified by me(showed in legend) is not the same as the finally filled in below the chart, is there any way to make sure that the different color will not mixed together?
Below is the code I used to draw two of the lines
LineDataSet vlfDs = new LineDataSet(vlfValues, "VLF");
vlfDs.setMode(LineDataSet.Mode.CUBIC_BEZIER);
vlfDs.setCubicIntensity(0.2f);
vlfDs.setDrawFilled(true);
vlfDs.setDrawCircles(false);
vlfDs.setLineWidth(0);
vlfDs.setCircleRadius(4f);
vlfDs.setColor(Color.YELLOW);
vlfDs.setFillColor(Color.YELLOW);
vlfDs.setFillAlpha(100);
LineDataSet lfDs = new LineDataSet(lfValues, "LF");
lfDs.setCubicIntensity(0.2f);
lfDs.setDrawFilled(true);
lfDs.setDrawCircles(false);
lfDs.setLineWidth(0);
lfDs.setCircleRadius(4f);
lfDs.setCircleColor(Color.WHITE);
lfDs.setColor(Color.GREEN);
lfDs.setFillColor(Color.GREEN);
lfDs.setFillAlpha(100);
hrvLineData = new LineData(hfDs,lfDs,vlfDs, hrDs);
hrvLineData.setValueTextSize(0);
hrvLineData.setDrawValues(false);
hrvChartView.setData(hrvLineData);
hrvChartView.invalidate();
It's turned out that I need to use setFillAlpha(255) instead of setFillAlpha(100)
You can also use something similar to the following solution which overrides the default LineChartRenderer and a uses a custom implementation of IFillFormatter to fill only the areas between the datasets.
Android - Fill the color between two lines using MPAndroidChart
Related
I'm trying to make a signature field in iText, but the name is not getting aligned with the underline.
Left underline needs to be centralized with left name, and same in other side... And they have to be side by side
How can I do that?
Code:
Paragrafo.Add(New iText.Layout.Element.Paragraph().AddTabStops(New iText.Layout.Element.TabStop(400, TabAlignment.RIGHT)).Add("_____________________________ ").Add(New iText.Layout.Element.Tab()).Add("_____________________________"))
Paragrafo.Add(New iText.Layout.Element.Paragraph().AddTabStops(New iText.Layout.Element.TabStop(400, TabAlignment.RIGHT)).Add("MICHEL SANTOS DO NASCIMENTO").Add(New iText.Layout.Element.Tab()).Add("CLEDOMIR JOSE BERLATTO"))
document.Add(Paragrafo.SetFontSize(12).SetTextAlignment(TextAlignment.LEFT))
Result of code:
There are nicer ways to add the signature lines into your PDF - you can add tab stops and tab leaders instead of adding dashes. Then you can use central alignment for tab stops to make sure your text is aligned as you want.
Example code (it's in Java, but you can easily convert it yo VB.NET similarly to how I converted your VB.NET code into Java):
// Tab stops represent left and right coordinates for two lines
java.util.List<TabStop> tabStopsLines = Arrays.<TabStop>asList(new TabStop(50),
new TabStop(250, TabAlignment.LEFT, new SolidLine()),
new TabStop(300), new TabStop(500, TabAlignment.LEFT, new SolidLine()));
document.add(new Paragraph().addTabStops(tabStopsLines).add(new Tab()).add(new Tab()).add(new Tab()).add(new Tab()));
// Tab stops represent centers of the lines
java.util.List<TabStop> tabStopsText = Arrays.<TabStop>asList(new TabStop(150, TabAlignment.CENTER),
new TabStop(400, TabAlignment.CENTER));
document.add(new Paragraph().addTabStops(tabStopsText).add(new Tab()).add("MICHEL SANTOS DO NASCIMENTO").add(new Tab()).add("CLEDOMIR JOSE BERLATTO"));
Visual result:
I am trying to write a pine script with two indicators one overlaid on the chart (EMA) and another on its own?(Stoch) I cannot seem to find any info on how to separate these (Visually) but keep them within 1 pine script, ie to be able to take trading decisions based on these.
The earlier answer from Luc is right, unfortunately. Each script can either create plots that are overlaid on the default price chart, or shown in a different pane, but not both. But there is a workaround.
Suppose you've made some non-trivial calculation in your script and you'd like to put it in different pane. E.g. the next code:
//#version=4
study(title="Stochastic", shorttitle="Stoch", format=format.price, precision=2)
periodK = input(14, title="K", minval=1)
periodD = input(3, title="D", minval=1)
smoothK = input(3, title="Smooth", minval=1)
k = sma(stoch(close, high, low, periodK), smoothK)
d = sma(k, periodD)
plot(k, title="%K", color=color.blue)
plot(d, title="%D", color=color.orange)
h0 = hline(80)
h1 = hline(20)
fill(h0, h1, color=color.purple, transp=75)
// This next plot would work best in a separate pane
someNonTrivialCalculatedSeries = close
plot(ema(someNonTrivialCalculatedSeries, 25), title="Exporting Plot")
Because they have different scale, one of them most likely will break another indicator's scale.
So you'd like show Stoch in different pine, whereas ema() should be overlayed with the main chart. For that you should make the next steps:
Turn off in the study's the extra plot to return scale to normal:
Apply to the chart the next script:
//#version=4
study("NonOverlayIndicator", overlay=true)
src = input(defval=close, type=input.source)
plot(src)
Choose in the second's script inputs source required plot from the first script:
And voilĂ - you got the plots in different pines:
But if you want split the plots because you have retrictions on amount of studies you allowed to apply (e.g. 3 for free-account) - that won't help you.
It cannot be done. A script runs either in overlay=true mode on the chart, in which case it cannot direct plots elsewhere, or in a separate pane when overlay=false (the default).
When the script is running in a pane, it can change the color of the chart bars using barcolor(), but that's the only way it can modify the chart.
It is possible to rescale signals so that multiple bounded (e.g., 0-100, -1 to +1) signals generated by one script appear one on top of the other, but this is typically impossible in overlay mode, as the vertical scale varies with the bars on the chart. The only way for an overlay script to work with its own scale is when it uses No scale, but this prevents the indicator's plots to plot relative to price, and so the chart's bars.
Nice workaround from Michael.
Unfortunately, this only seems to work to pass data for one plot.
I would like to pass data for 3 different plots to the stock price graph.
If I try this, for 'input.source' I can only select the standard sources: "open, high, low, close ...". I can not select the data from other indicators.
If I remove plots 2 and 3, it works as Michael described.
Anybody has a workaround for the workaround..? ;-)
everyone ! I;m working on a Highchart where it appends values to the chart for every 5 seconds time. I'm adding points like this,
series.addPoint([(new Date()).getTime(), xnum(n.PointValue)], true, true);
When adding a point I want to add the point with a different color (RED) based on some other property. Can anyone help me to add the point with a different color ? Thanks
You could pass the color directly while adding a new point. Instead of array try using an object with a property 'color'.
series.addPoint({
y:(new Date()).getTime(),
x:xnum(n.PointValue),
color:some_condition?'red': 'blue'},
true, true);
An example pen
https://codepen.io/samuellawrentz/pen/XYVBjR?editors=1010
Good Day To All
I'm new to pCharts, works great!
I'm trying to create a bar chart with 2 thresholds and display different bar colors. Setting the thresholds is done and works well. Now I would like to set the standard palette to a set color and only the bars that exceed the specified second threshold should be a different color.
My data consists of times file were imported
So in theory, if possible, all bars exceeding the 2nd limit should be red or pink or whatever.
Is this possible? If so, where do I start fiddling?
I have tried OverideColors with an if statement but it seems not to work so well.
Any info would be very helpful.
Thanks
Ok, so here is the code. I know there might be better or cleaner ways of doing it but this works:
/*Palette per Bar*/
$thold = strtotime("09:30:00");
foreach ($lastdate as $over) {
if ($over < $thold) {
$color = array("R"=>0,"G"=>204,"B"=>204);
$Palette[] = $color;
}
else {
$color2 = array("R"=>224,"G"=>46,"B"=>117);
$Palette[] = $color2;
}
}
Hope this helps
we are developing an windows 8 store apps and telerik charts to display charts. In one of the charts we need to show the chart having 2 y-axis and bar series need to bind to left side of the y-axis and line series need to bind data to right side of the y-axis(secondary y-axis). So i posted in one of the forum and got reply form them and i like to share the answer.
Here is the solution I suggest. You have to create a class that inherits the Collection class in your project.
public class CustomAxes : Collection<Axis> { }
This will make it possible to define custom collection of axes that will be used by the corresponding series. Next you have to create CustomAxes object in the resources of your application and fill it with the axes you want to have in your chart:
<local:CustomAxes x:Key="customAxes">
<telerik:LinearAxis HorizontalLocation="Left"/>
<telerik:LinearAxis HorizontalLocation="Right"/>
</local:CustomAxes>
Now you have to bind the vertical axes of your series to the custom axes:
<telerik:BarSeries VerticalAxis="{Binding Source={StaticResource customAxes}, Path=[0]}">
Here is the sample code attached in this forum.